| 
			Apcoordinator ユーザーズガイド
		 | 
	
	
		
			目次
			  
		 | 
	
24.2.3 SessionContextの取得
EJBコンテナはjavax.ejb.SessionContextインタフェースを実装したオブジェクトをセションBeanに与えます。このSessionContextを取得するには、EJBSessionProfileのgetEJBContextメソッドを使用します。このメソッドをビジネスクラスで呼び出す例を示します。
import com.fujitsu.uji.ejb.bean.EJBSessionProfile;
import javax.ejb.SessionContext;
public Object search(DispatchContext context, HashMap data) {
  EJBSessionProfile sp = (EJBSessionProfile)context.getSessionProfile();
  SessionContext sessionContext = (SessionContext)sp.getEJBContext();
}
  | 
getEJBContextメソッドの返り値の型はSessionContextのスーパーインタフェースであるEJBContextです。これをSessionContextにキャストして使用します。
EJBSessionProfileのメソッドを利用するには、DispatchContextのgetSessionProfileでセションクラスを取得し、それをEJBSessionProfileにキャストします。 
All Rights Reserved, Copyright © 富士通株式会社 2000-2005