Meaningless Drivel is fun!*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Bean Things in ejbRemove, unsetEntityContext. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Bean Things in ejbRemove, unsetEntityContext." Watch "Bean Things in ejbRemove, unsetEntityContext." New topic
Author

Bean Things in ejbRemove, unsetEntityContext.

Rehana Shaik
Ranch Hand

Joined: Jan 03, 2003
Posts: 33
Hello,

If follwoing are the bean things (extracted from Heads First for EJB):

1. get reference to EJB Home
2. get reference to EJB Object
3. get security information from client
4. get primary key
5. force a transaction to rollback(CMT)
6. find if a transaction is already set to rollback(CMT)
7. get transaction reference and call methods on it(BMT)

Which are allowed to be done in :
1. stateless session bean's ejbRemove?
2. ejbRemove and unsetEntityContext of entity bean (CMT).
3. onMessage in message driven bean (ofcourse 1, 2, 3, 4 are already
ruled out).

Thanks in advance.
P Chittaranjan
Ranch Hand

Joined: Feb 09, 2006
Posts: 47
Hi Rehana Shaik,

Q1. For ejbRemove method in stateless session bean:
These are allowed
1. get reference to EJB Home
2. get reference to EJB Object
7. get transaction reference and call methods on it(BMT)
These not are allowed
3. get security information from client ( stateless session beans doesnot have any client specific information )
4. get primary key ( this cannot be called for session beans)
5. force a transaction to rollback(CMT) ( scince ejbRemove is running in a unspecified transaction , this is not allowed)
6. find if a transaction is already set to rollback(CMT) ( scince ejbRemove is running in a unspecified transaction , this is not allowed)


Q2.
For ejbRemove method in entity bean

All are allowed except
7. get transaction reference and call methods on it(BMT)-- because entity bean is always Container Managed.

For unsetEntityContext method in entity bean
This method is called when the entity object(not representing any entity in the persistent store) is in the pool.
Only 1. get reference to EJB Home is allowed here.

Q3.onMessage in message driven bean (ofcourse 1, 2, 3, 4 are already
ruled out).

This one you have already answered. 5 & 6 for CMT and 7 for BMT are allowed.



Thanks,
Chittaranjan


Thanks,<br />Chittaranjan<br />SCJP 5.0,SCWCD1.4,SCBCD 5
 
GeeCON Prague 2014
 
subject: Bean Things in ejbRemove, unsetEntityContext.