File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Number of EJBObjects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Number of EJBObjects" Watch "Number of EJBObjects" New topic

Number of EJBObjects

Saurav Chatterjee

Joined: Mar 31, 2005
Posts: 12
I am looking up for the component interface from my servlet. Means that part of the code can be executed by many threads. I am using stateless session bean.
Now say there are 2 sessions and 3 threads. 2 belongs to 1 client and another 1 to another client.
My question is that in this situation how many EJBObjects will be created?
Annie Smith
Ranch Hand

Joined: Mar 05, 2005
Posts: 172
Refer to Ed Roman - Mastering EJB2 page 48

Some containers can have a 1:N relationship, where each EJB object is multithreaded (just like home objects). Other containers might have an M:N relationship, where M represents the number of EJB objects instantiated (and corresponds exactly to the number of clients currently connected), and N represents the number of bean instances in the pool.

IIRC, a 1:1 relationship is maintained by most containers.

Cheers!<br /><b>Annie</b>
Saurav Chatterjee

Joined: Mar 31, 2005
Posts: 12
Thanks and sorry for the delay....
Basically thats the relation between EJBObject and bean(if I got it right).
But I wanted to know what will be the relation between client and ejbobject?
Head first EJB says the relatio is 1:1. But I wonder what will be the case in case of threaded applications.
I agree. Here's the link:
subject: Number of EJBObjects
jQuery in Action, 3rd edition