Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Activities in each method of CMP Entity Bean

 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Method of CMP Entity Bean :
<required>
1. setEntityContext(EntityContext);
2. ejbActivate
3. ejbPassivate
4. ejbLoad
5. ejbStore
<option>
6. ejbFindByPrimaryKey (Not declare in bean class) managed by Container.
7. ejbCreate<METHOD>
8. ejbPostCreate
9. ejbHome<METHOD>
10. abstract ejbSelect<METHOD>
I confuse about process can be occur/use in each method such as
ejbPassivate method can be set value of non-transient variable....
setEntityContext ? and so on ....

Thank you very much for all answer.
 
Kathy Sierra
Cowgirl and Author
Rancher
Posts: 1589
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy --
The best advice I can give for this is to look at page 179 and 180 in the EJB 2.0 spec. There's a table that includes virtually everything that matters as far as the test objective that wants to know if you know what's allowed and what is not allowed in each method.
Now... this is perhaps one of the hardest areas of the exam because you really do have to know these. But most of them make sense if you really stop to think about it. So, trying to just memorize them all will be difficult, but if you try to understand why some things are allowed and some aren't, most will make perfect sense, and then you won't need to rely so much on memorization.
An exercise in the book is a table that lists each of the methods, and then there is a checklist for you to check off depending on whether that operation is allowed from within that method. It's just another way of recreating the table on 179 and 180 (but easier to read, I think).
The checklist is like this:
[BOLD]
Use your EntityContext to: [/BOLD]
* getEJBHome
* getEJBLocalHome
* getCallerPrincipal
* getRollbackOnly
* isCallerInRole
* setRollbackOnly
* getEJBObject
* getEJBLocalObject
* getPrimaryKey
[BOLD]
ACCESS: [/BOLD]
* java:comp/env
* a resource manager (like a JDBC connection)
* another bean's methods
* your own CMR fields
So, using the checklist above, go through the following list of methods, and decide which things in the list above can -- or cannot -- be done in that method:
* constructor (not a method, but still...)
* setEntityContext / unsetEntityContext
* ejbCreate
* ejbPostCreate
* ejbRemove
* ejbHome
* ejbActivate / ejbPassivate
* ejbLoad / ejbStore
* business method from component interface
It really will make a HUGE difference if you try to work this out yourself, rather than trying to memorizing the spec pages.
cheers,
Kathy
 
somkiat puisungnoen
Ranch Hand
Posts: 1312
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic