`

SCBCD Notes

    博客分类:
  • EJB
 
阅读更多

 

Client can NOT call EJB direct, but through mediator
JMS in case of MDB(Message Driven Bean)
 
Container provides class implementing bean's interface: component interface & home interface
Instance of class implementing component interface is called EJBObject
 
client call EJB through two player: EJBObject & container
 
  • statless bean is put in a pool serving many client
  • statful bean serves one client only and destroyed after one session ends
 
Things to remember - Inside a Bean
  • Do not directly read/write File Descriptor
  • Never try to obstain security policy of source code
  • Never use object substitute or subclass feature of java serializable protocol
  • Never pass this as parametor or return 
  • Do not implement Bean as Server-like activity e.g. listener, multicasting on a socket
  • Never create/set/access classloader
  • Never set/create security manager
  • Never try to stop JVM
  • Never try to change input/output , error stream
  • Never try to set factory that is used by Server socket, and stream handle factory that is used by URL
  • Never
    • start, stop, resume a thread
    • change priority of a thread
    • change name of a thread
 
  • Must not define a class
  • Not try to acess security configuration object such as identifier, Signer, provider, security
 
Same Bean can not define two env entries with same name
Different Bean can defined same env entries with same name, as when they access from bean it get its own variable
 
EJB communicate with container through SessionContext & SessionBean Interface
 
Home interface has create() and remove() method, create() needs to be defined, but remove() is inherited from parent
 

Create method in EJB

StateFul StateLess
declare mandatory, no argument method
at least one create() is mandatory, e.g.
createABC(...)
createBBB(...)
Bean instance creation create a new bean get bean from pooling
Common property argument must be serializable, primitive argument must be serializable,primitive

Remove method in EJB

Entity StateFul StateLess
1. Remove(PrimaryKey)
2. Remove(Handle)
1  2. will remove instance
2. no effect, will go back to pool 
 Common  Contaner event, client can not call  Contaner event, client can not call
 
There is exactly one Object for each Session Bean Type, Multi EJBObject
e.g. 100 clients have 1 HomeInterface, but 100 EJbObject
 
method starting with ejbMethodA...() is container callback method
method can not throw RunTimeException(...)
 

isdential() method of EJBObject

  • stateful bean never been true
  • stateless bean return true, if referenced the client's handled by the same homeInterface
  • EjbObject are compared by isIdentical(), NOT equals()

 

EJBObject's remove() doesnt have argument, remove itself

HomeInterface's remove(...) has argument, as it needs argument to determine which one to remove

 

HomeLocalInterface does NOT have method for Handler & metaDate( in save JVM, information of method can be abtained from reflection)

 

Local HomeInterface doesn't have remove(handler), remove can be done directly call the LocalEJBOBject to remove itself

Remove sessionbean client can remove via RemoteHomeInterface & remote EJBObject

 

LocalHomeInterface can NOT be passed to remove call

 

In Bean method, dont declare throw RemoteException

 

setEntityContext and setSessionContext are used to setup sessionBean to interact with container

 

For stateful bean, when user call create(), createABC() in home Interface, EJB container will call ejbCreate() or ejbCreateABC() defined in session Bean respectively

 

EntityContext & SessionContext

  • One difference is that the entityContext has getPrimaryKey()
  • setSessionContext() can call two method of container: get Home Interface, and JNDI access
  • following method ejbCreate().

 

remove method call for statelss bean is ignored

 

Container will not passivate if session is in Transaction

 

remove is not call under:

  1. time out in passivate state
  2. bean throw exception
  3. server crashes

 

 Entity Bean

  • If can not find single entity, throw ObjectNotFoundException
  • If can not find group entity, return empty collection

 

For CMP, don't need write find method

For BMP, each findXXX method in Home Interface, must have a match ejbFindXXX in Bean Class

 

 Home Interface can implement business logic which is not entity related

 for each method, you are required to write ejbHomeXXX method in Bean

 

 Each Bean Type has its own pool

 

 Entity bean can only use ONLY CMT demartation, can NEVER use getUserTransaction method

 

 Only difference between EntityContext & SessionContext is getPrimaryKey() defined in EntityContext

 
EJB Remote interface is closely related to RMI-IIOP protocol
Parameter passed into EJB method must be RMI-IIOP conpatible
 
EJB Object - Container generated Remote Interface Implementation
Local Object - Container generated local interface implementation
Home Object - Container generated home interface implementation
Loca home Object - Container generated local home interface implementation
 
System exception - Container will process it
Application excepton - should throw back to client/ the only exception for remote EJB thrown back is REMOTE or its subClass
 
EJB bean is called via EJB Object, thus if your bean calls another bean, you must pass reference to your bean's EJB Object rather than reference of your bean; Just like another client, everything must go through EJB Object
 
When bean is passivated, it might hold reference to container-implemented object, the following object will be passivated as well
  1. EJB Object reference
  2. Home Object reference
  3. EJB context reference
  4. JNDI naming context
 
Stateless can define a few overloaded ejbCreate(...)
Stateful can only define one empty ejbCreate()
 
The biggest difference between the stateful session bean and the other bean types is that stateful session beans don't use instance pooling.
 
 

 

 

 


分享到:
评论

相关推荐

    SCBCD_NOTES_JIAFAN

    根据提供的文档内容,我们可以归纳出一系列关于SCBCD(Sun Certified Business Component Developer)考试准备的知识点。这份文档由作者周家帆撰写,并经过多次修订,最终版本为V1.0,发布日期为2009年8月10日。下面...

    SUN SCBCD 考试教程(两份)

    SCBCD,全称为Sun Certified Business Component Developer,是Oracle(原Sun Microsystems)公司推出的一门认证考试,旨在验证开发者在Java EE(Enterprise Edition)平台上构建企业级应用组件的能力。这门考试主要...

    SCBCD-091资料

    SCBCD是Sun Certified Business Component Developer的缩写,这是一个针对Java EE企业级应用开发的认证。这个"SCBCD-091资料"很可能是针对SCBCD认证考试的学习资源,可能包括讲义、练习题、模拟测试等,旨在帮助考生...

    SCBCD Exam Study Kit

    SCBCD Exam Study Kit Java Business Component Developer Certification for EJB.Jun.2005 sun认证材料

    SCBCD Simulator

    SCBCD simulator, includes about 300 questions and explanation

    SCBCD summary

    ### SCBCD Summary知识点 #### 1. 实体管理器(EntityManager)与EJB版本兼容性 - **容器管理的实体管理器**:容器管理的`EntityManager`必须是JTA类型的实体管理器。这意味着在使用容器管理的实体管理器时,它会遵循...

    MZ_SCBCD_5_Study_Guide

    ### SCBCD 5.0 Study Guide:SUN EJB3.0认证考试知识点解析 #### 一、EJB3.0概述 **知识点1:EJB3.0技术的用途、优势及特性** - **用途与优势**:EJB(Enterprise JavaBeans)3.0是Java EE平台的核心组件之一,...

    310-091 SCBCD5 sun java

    【310-091 SCBCD5 Sun Java】是Oracle公司早期针对Sun Microsystems的Java平台进行的一项专业认证考试,全称为"Sun Certified Business Component Developer for the Java EE 5 Platform"。这个认证主要测试开发者在...

    sun公司SCJP认证

    SUN公司2009年最新SCJP考试认证大纲,详解考试题型及内容

    java 认证终极指南

    包含了SCJP5.0\SCWCD1.4\SCBCD1.3\SCBCD5.0\SCDJWS1.4\SCDJWS5.0\SCEA5.0\IBM Test 255\IBM Test 257\IBM Test 287\IBM Test 733等众多英文版参考资料,考试必备,内含源码,本人特别贡献出来给大家,绝对物超所值!

    SCBCDExamStudyKitJavaBusinessComponentDeveloperCertificationforEJB.pdf 英文原版

    SCBCD Exam Study Kit Java Business Component Developer Certification for EJB

    深入浅出EJB

    确实,你也想通过Su n认证业务组件开发人员(SCBCD)考试,但不仅如此,你还需要真正把EJB用到实处。你要构建应用,要对付最后期限,如果通过考试之后第二天早上就把你学过的EJB知识忘得一干二净,你肯定会受不了。 ...

    Android代码-tech-weekly

    通过 SUN Java(SCJP、SCWCD、SCBCD)以及 Oracle OCA 等的认证。 > 斗鱼直播 > > B 站录播 沟通交流 Apache Dubbo开源讨论群”群的钉钉群号: 21973601 Spring Cloud Alibaba 开源讨论群”群的钉钉群号: ...

    Reilly.Enterprise.JavaBeans.3.1.6th.Edition.2010

    这本书由Oracle Corporation认证,为希望获得OCP(Oracle Certified Professional)和SCBCD(Sun Certified Business Component Developer)资格的开发者提供了详尽的教程和实战指导。 EJB是Java企业级应用开发的...

    SUN JAVA经典认证11本书

    4. **SCBCD(Sun Certified Business Component Developer for Java 2 Platform, Enterprise Edition)** SCBCD专注于Java EE中的企业级组件,如EJB(Enterprise JavaBeans)。书籍可能讲解了EJB架构、实体Bean、...

    SCJP,認證型態美國Sun網站於2006年5月公

    - 专业(SPECIALTY):如SCJD、SCWCD、SCBCD等,面向具有较高技术水平的专业开发者。 - 进阶(ADVANCED):目前尚未有明确提及的进阶级别的认证。 ### 具体认证介绍 1. **SCJA1.0**(Sun Certified Associate ...

    JAVA认证资料

    3. **SCBCD**:Sun Certified Business Component Developer for the Java 2 Platform, Enterprise Edition,即Java商业组件开发员认证——企业级平台。 #### 二、JAVA职业发展路径 Java认证不仅是对个人技术能力...

    tech-weekly:「小马哥技术周报」

    「小马哥技术周报」 「小马哥技术周报」是小马哥在斗鱼平台的技术分享直播,通常时间安排在每周五晚上八点半,具体通知请关注微信公众号: ...通过SUN Java(SCJP,SCWCD ,SCBCD)以及Oracle OCA等的认证。 着书

    Head First Servlets and JSP (第二版 英文版)

    3. **Oliver Roell**(SCJP, SCJD, SCBCD, SCWCD, SCEA):对于初学者来说,这是市场上最好的Servlet技术入门书籍之一。 4. **Theodore Casser**(高级软件开发者,Nanavati Consulting):强烈推荐给所有对Java EE...

    Head First Servlet/JSP 2nd edition

    3. **Oliver Roell**(SCJP, SCJD, SCBCD, SCWCD, SCEA):“市场上没有比《Head First Servlets & JSP》更好的介绍Servlet技术的书籍了。如果你是Java Web开发的新手,并且想要轻松地阅读并真正理解内容,那么你别...

Global site tag (gtag.js) - Google Analytics