EJB方法總結

來源:互聯網
上載者:User

通用的介面

Interface EJBObject

EJBHome

getEJBHome()得到bean的Home.

 Handle

getHandle()儲存EjbObject的一個引用   

 Object

getPrimaryKey() 得到實體bean的主鍵  

 boolean

isIdentical(EJBObject obj) 比較兩個EJBObject是否引用同一個

 void

remove() 對會話bean說釋放這個bean為客戶保留的資源

對實體bean來說 刪除一行記錄
        

 

 

Interface EJBMetaData

EJBHome

getEJBHome()
          Obtain the remote home interface of the enterprise Bean.

 Class

getHomeInterfaceClass()
          Obtain the Class object for the enterprise Bean's remote home interface.

 Class

getPrimaryKeyClass()
          Obtain the Class object for the enterprise Bean's primary key class.

 Class

getRemoteInterfaceClass()
          Obtain the Class object for the enterprise Bean's remote interface.

 boolean

isSession()
          Test if the enterprise Bean's type is "session".

 boolean

isStatelessSession()
          Test if the enterprise Bean's type is "stateless session".

 

 

 

 

javax.ejb
Interface EJBHome

 EJBMetaData

getEJBMetaData() 從Bean得到反射子類的資訊
          Obtain the EJBMetaData interface for the enterprise Bean.

 HomeHandle

getHomeHandle() 對home序列化,可以通過這個方法再次得到和使用這個home,無需通過JNDI
          Obtain a handle for the remote home object.

 void

remove(Handle handle) 刪除會話bean
          Remove an EJB object identified by its handle.

 void

remove(Object primaryKey)刪除實體Bean
          Remove an EJB object identified by its primary key.

 

I   會話bean 

     

Stateful sessionBean 的生命週期 

當用戶端調用Home上的create()方法

容器會建立Ejb對象和SessionContext

     當容器構造Bean執行個體

     容器會調用setSessionContext()和EjbCreate() 把bean和他的上下文和ejb對象串連起來。

容器向客戶發送EJB對象的一個樁――就是-stub是rmi中運用的

 

 

 

StateLess SessionBean的生命週期

 

順序圖表

 

 

在無狀態會話bean

 

客戶在無狀態會話bean Home調用建立方法

1.  客戶在home調用建立方法

2.  容器建立EJB對象。

3.  容器給客戶發送EJB對象的一個樁――就是stub

無狀態會話bean建立―――與客戶無關

1.容器構造SessionContext對象和bean執行個體,然後在這個bean上調用

     setSessionContext()

     2. 容器把這個bean(現在已經與他自己的上下文串連)放到這種類型bean的池中。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.