aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Question about remove() method of the Session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Question about remove() method of the Session bean" Watch "Question about remove() method of the Session bean" New topic
Author

Question about remove() method of the Session bean

Simeon Cherniy
Greenhorn

Joined: Jul 26, 2006
Posts: 21
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 ]

5-year Student of <br />Moscow Institute of Physics and Technology.
Rajesh Agarwal
Ranch Hand

Joined: Aug 01, 2005
Posts: 79
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

Joined: Jul 26, 2006
Posts: 21
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

Joined: Sep 22, 2005
Posts: 46
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Question about remove() method of the Session bean