Win a copy of Pro Spring MVC with WebFlux: Web Development in Spring Framework 5 and Spring Boot 2 this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

Question about remove() method of the Session bean

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic