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

what if client explicitly call EJBHome.remove()

 
Denis Wang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In practice I don't see an application explictly do so since the lifecycle is automatically managed by the container. However, what if the client DOES so since it is legal.
Another related question: if the bean is already in the pool, will ejbCreate() be invoked?
 
E. Messing
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateless/StateFull Session ? Entity ? Both ? Please narrow ( the question, not the JNDI reference (J2EE joke. not funny...) )
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJBHome provides two remove methods: remove(Handle handle) and remove(Object primaryKey).
I think you can guess what they do.
 
Denis Wang
Ranch Hand
Posts: 81
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbRemove() method is invoked when a client invokes a remove operation on the enterprise Bean's home interface or the EJB object's remote interface.
EJBHome.remove(handle/PrimaryKey) is self-explaining, but EJBObject has remove() with no parameter.
 
k space
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ejbRemove() method is invoked when a client invokes a remove operation on the enterprise Bean's home interface or the EJB object's remote interface.

Not always true, as different beans have different lifecyles and are managed by the container.
For example, when a client invokes the remove() on a stateless session bean's remote interface, the container may do nothing.
ejbRemove() only gets called when the container decided to remove the object permanently. For CMP entity bean, the corresponding database row will also be removed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic