This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes EJB and other Java EE Technologies and the fly likes Will the singleton use on EJBObject cause problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Will the singleton use on EJBObject cause problem?" Watch "Will the singleton use on EJBObject cause problem?" New topic
Author

Will the singleton use on EJBObject cause problem?

Allan Stone
Greenhorn

Joined: Oct 21, 2005
Posts: 24
For stateless session beans, beans are not tied to EJBObject until the client calls a business method. And the container manages the bean creation if needed.

Then, how about EJBObject, should an application create an EJBObject instance every time it needs to call a business method?

If two or more clients invoke business method on the same instance of EJBObject simultaneously, what will happen?


Practice make perfect.<br /> <br />SC-(JP/WCD/BCD/EA)
Vinay Raj
Ranch Hand

Joined: Jun 19, 2006
Posts: 81
It is definitely not recommended way of using session beans. Two or more clients invoke business method on the same instance of EJBObject simultaneously can be done via user developed multi-threaded program, which is a strict no-no in EJBs. The obvious problem areas would be transaction, security management.
 
Don't get me started about those stupid light bulbs.
 
subject: Will the singleton use on EJBObject cause problem?