日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

EJB的设置和使用

發布時間:2023/12/14 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 EJB的设置和使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1、ejb定義?
? a、定義一個ejb接口:繼承EJBObject類,定義方法名;?
? b、定義ejb類:實現SessionBean接口,并實現ejb接口中的方法;?
? c、定義home類:繼承EJBHome類,創建ejb接口對象。?
?? 例如:?
??? public interface VentureHome extends EJBHome {?
?????? Venture create() throws CreateException, EJBException,RemoteException;}?
????
2、ejb的配置?
?? a、在ejb-jar.xml中配置session和method?
??? 例如:?
?????? session的配置:?
??????????????????? <session id="Venture">?
<ejb-name>Venture</ejb-name>?
<home>com.iss.itreasury.bill.venture.bizlogic.VentureHome</home>?
<remote>com.iss.itreasury.bill.venture.bizlogic.Venture</remote>?
<ejb-class>com.iss.itreasury.bill.venture.bizlogic.VentureEJB</ejb-class>?
<session-type>Stateless</session-type>?
<transaction-type>Container</transaction-type>?
<resource-ref id="ResourceRef_1293009859115">?
<description>DataSource Resource</description>?
<res-ref-name>jdbc/cpf/type4</res-ref-name>?
<res-type>javax.sql.DataSource</res-type>?
<res-auth>Container</res-auth>?
<res-sharing-scope>Shareable</res-sharing-scope>?
</resource-ref>?
</session>?

??????? method的配置:?
?????????????????????? <method>?
???????? <ejb-name>Venture</ejb-name>?
???????? <method-name>*</method-name>?
?????? </method>?
?? b、web.xml的配置?
????? <ejb-ref id="EjbRef_1293021770030">?
<description>?
</description>?
<ejb-ref-name>TransferLoanContractDepositHome</ejb-ref-name>?
<ejb-ref-type>Session</ejb-ref-type>?
<home>com.iss.itreasury.settlement.transferloancontract.bizlogic.TransferLoanContractDepositHome</home>?
<remote>com.iss.itreasury.settlement.transferloancontract.bizlogic.TransferLoanContractDeposit</remote>?
<ejb-link>itreasuryEJB.jar#TransferLoanContractDeposit</ejb-link>?
</ejb-ref>?
3、ejb的使用方法:?
? 使用ejb類時不能直接new,調用方法是可能不報錯,但是執行代碼時會跳過此方法。?
??? 正確的方式是:先定義一個TransCurrentDepositHome對象,用EJBHomeFactory類生成,同時定義一個ejb接口的對象,有TransCurrentDepositHome類的create()方法創建。?
例如:?

TransCurrentDepositHome home =

(TransCurrentDepositHome)EJBHomeFactory.getFactory().lookUpHome(TransCurrentDepositHome.class);

transCurrentDepositFacade = (TransCurrentDeposit) home.create();

總結

以上是生活随笔為你收集整理的EJB的设置和使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。