• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Need Clarification-REgarding Sharpen your Pencil

 
vinod balaji
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HF EJB: PgNo:323:

Sharpen Your Pencil EJB Entity Bean)

I want to confirm the answers for the question:

1. The Client Calls this method to tell the container that he(client) is done using the bean's EJB Object reference:

2. This method is called when the bean goes back to the pool, after an entity is deleted from the database:

3. This method is called immediately after the bean's constructor runs:

4. This Method is called on the bean when the bean is in the pool and the client invokes a business method on the component interface.

My Answer:

1.ejbPassivate()
2.ejbRemove()
3.setEntityContext()
4.ejbActivate()

Please correct me if iam wrong..


Thanks
 
Devendra Inamdar
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1 - remove
since ejbRemove is never called by Client but Container. In case of entity bean calling remove means client is done not just with the EJB Object but with the entity in the database also which will be permanently deleted.

2 - ejbPassivate
 
vinod balaji
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Davendra for your reply.
 
Suresh Babu Shanmugam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. No methods for this kind of task

2. ejbRemove()

3. setEntityContext()

4. ejbActivate()
[ February 28, 2007: Message edited by: Suresh Babu Shanmugam ]
 
Rahul Toaikani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suresh,
For #1 is exactly what remove does.There is very good explanation of remove in HF book.

regards.
 
Suresh Babu Shanmugam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Rahul,

1. The Client Calls this method to tell the container that he(client) is done using the bean's EJB Object reference:

Here, Client is done with EJBObject reference not with entity. So if remove method is called, Entity in Database will be deleted. #1 is applicable for Session Bean, where if client is done, he/she can call remove method. it is not possible with Entity Bean. No method for doing so in Entity Bean. :-)
 
Rahul Toaikani
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You got me there

Entity Bean's remove() will actually remove entity from the database.You are correct, there is no way client can specify that he is done with the EJBObject(which can be representing session or entity or message-driven)
 
Ugender Rekulampally
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
unsetEntityContext() method says, its done with the bean it is dealing with.

Thanks,
Ugender
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic