Re: [問題] EJB Object / Interface ?
在 EJB Spec 2.0 後
session bean 和 entity bean
可以有(概念上)
remote client view 和 local client view 兩種view
"view" 可以當作是 "使用bean的方法/觀點"
(稍微具體一點)就是可以擁有
local home interface 和 local component interface
remote home interface 和 remote component interface
...通常如果指"remote" "remote"這個字可以被省略不講 .......
local / remote 的不同(非常簡略的列出...)
local 和 remote 可以同時存在 只是會依據不同環境或設計 被使用
remote:
+ 使用在分散式環境 不同JVM之間
- 效能低
+ Call by value
local:
+ 使用在同一JVM上
+ 效能高
+ Call by Reference
+ container managed relationship/persistence
+ 一定要在同一個EAR裡
(實作上)java API裡..有這些Interface ...可以對應上面
EJBHome 和 EJBObject (分別 extends java.rmi.Remote)
EJBLocalHome 和 EJBLocalObject
看來 EJB*Home 是用來存取使用 EJB*Object
EJB*Object 是用來存取使用 真正EJB的"實體"(instance)
(我把javadoc列出來 希望有懂的人 能再講清楚一點 或指正
我覺得這些文件用字很不明確 也許都定義在spec裡吧...)
EJBHome
The EJBHome interface must be extended by all enterprise Beans'
remote home interfaces.
An enterprise Bean's remote home interface defines the methods that
allow a remote client to create, find, and remove EJB objects,
as well as home business methods that are not specific to a bean instance
EJBObject
The EJBObject interface is extended by all enterprise Beans'
remote interfaces.
An enterprise Bean's remote interface provides the remote client view
of an EJB object. An enterprise Bean's remote interface defines the
business methods callable by a remote client.
EJBLocalHome
The EJBLocalHome interface must be extended by all enterprise Beans'
local home interfaces.
An enterprise Bean's local home interface defines
the methods that allow local clients to create, find, and remove EJB objects,
as well as home business methods that are not specific to a bean instance.
EJBLocalObject
The EJBLocalObject interface must be extended by all enterprise Beans'
local interfaces.
An enterprise Bean's local interface provides the local client view of
an EJB object. An enterprise Bean's local interface defines the business
methods callable by local clients.
--
PLUR
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 84.162.124.219
※ 編輯: easy1 來自: 84.162.124.219 (11/14 07:12)
※ 編輯: easy1 來自: 84.162.124.219 (11/14 07:21)
※ 編輯: easy1 來自: 84.162.124.219 (11/14 07:30)
討論串 (同標題文章)
java 近期熱門文章
PTT數位生活區 即時熱門文章