エクスポートされたビュー行メソッドのコール

クライアント・プログラムで、ビュー行オブジェクト、ビュー・オブジェクト行プロキシおよび汎用アプリケーション・モジュールのJavaインタフェースが含まれたパッケージをインポートする必要があります。次に例を示します。

import package4.common.*
// includes package4.common.DeptView
// includes package4.common.DeptViewImpl

import oracle.jbo.*
// includes generic application module oracle.jbo.ApplicationModule

エクスポートされたビュー行アクセッサ・メソッドを使用するには、次のようにします。

  1. 汎用アプリケーション・モジュールのインスタンスを取得します。

  2. ビュー行オブジェクトへの参照を取得し、エクスポートされたアクセッサ・メソッドを含むビュー・オブジェクト行プロキシにこれをキャストします。

  3. エクスポートされたメソッドを使用します。

次に例を示します。

// Call create() to get the application module instance;
// cast it to the custom application module
ApplicationModule am = session.createApplicationModule();
   // Get a reference to the view object - Cast it to the custom  
// view object interface containing the exported method
ViewObject deptView = am.findViewObject("DeptView");
   // Call one of the view object methods that return a row
while ((row = deptView.next()) != null)
   // Cast the row to the view row interface containing the 
// exported accessor method
DeptViewRow deptRow = (DeptViewRow) row
   // Call the accessor method on the row
System.out.println("DEPTNO :"+deptRow.getDeptNo());

エクスポートされたビュー行メソッドのみを使用する場合には、アプリケーション・モジュールを、エクスポート後のインタフェースにキャストする必要はありません。