Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about remove() method of the Session bean

 
Simeon Cherniy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!
There is a question:

In the book "SCBCD Exam Study Kit" the author Paul Sanghera writes:

Can client use EJB
object reference after
calling a successful
remove()?

the answer is:

Stateless Session Bean: No. If used, it will receive
an exception.

I tried to call remove method on the var, that reffers to the EJBObject of the session bean instance, and after call business - method. I didn't catch any exception. I carried out this experiment with Bea WebLogic 8 server and JBoss server.

In the EJB 2.0 spec I hasn't found any information.

Could you clear my mind?

Thanks!
[ June 04, 2007: Message edited by: Simeon Cherniy ]
 
Rajesh Agarwal
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When the client calls remove() method in a session bean the call is not delegated to the ejbRemove() method of the bean. It just disassociates the EJB object with the instance.
 
Simeon Cherniy
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does happen with the EJBObject on the server side and its stub on the client side?
Are they removed or not?
 
Sunil Dixit
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
As you must be knowing that in Sateless session bean when you invoke any method on bean instance,after completing the its body (i.e. exit point of method) the bean instance is aotomatically de-associated with EJBObject.So even if you call EJBRemove on your EJBObject it doesn't matter.But as far as original query is concern that is 100% true but how to simulate that is big question.
Reason is if there is no instance is currently associated with EJBObject and you try to call any method than it will throw exception.
and we must remember by calling EJBRemove on Seesion bean it de-associate bean instance with EJBObject if any.
may be that is useful ?

Sunil
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic