Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB Design  RSS feed

 
Rahul JG
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In an Entity Bean, if a finder method returns a large number of records (say thousands of them), will thousand bean instances be created? If yes, what happens if the number of bean instances required to be created exceed the number of instances which have been specified to be maintained in the pool?
I know this question would have been asked many times in many forums, but I haven't been able to get a convincing reply. Can anyone answer me?
 
Sowmya BC
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,
>>In an Entity Bean, if a finder method returns a large number of records (say thousands of them), will thousand bean instances be created?
This depends on the Application Server that you are using. Most application servers do what is called as 'lazy loading'. When a finder method returns say 100 records, 100 Component Interfaces are created. Its only when you call a method on the bean that a bean instance is created.
>>If yes, what happens if the number of bean instances required to be created exceed the number of instances which have been specified to be maintained in the pool?
If your application server does'nt implement lazy loading & creates a 100 bean instances, well in this case your application server could hang.
>>I know this question would have been asked many times in many forums, but I haven't been able to get a convincing reply. Can anyone answer me?
Hope I was able to clear your doubt !!

Sowmya
http://www.pramati.com
 
Dave Van Even
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sowmya BC:

This depends on the Application Server that you are using. Most application servers do what is called as 'lazy loading'. When a finder method returns say 100 records, 100 Component Interfaces are created. Its only when you call a method on the bean that a bean instance is created.

Correct me if I'm wrong but aren't BEAN INSTANCES managed by the container and usually put in a pool ?
I understood that when you call a method on a component interface the container activates a pre-loaded bean from the pool (transfers it from unused to used) and loads the data into it. Only after this process the BEAN INSTANCE receives the method call priorly invoked on the component interface.

So 100 component interfaces would be created but these could use for example the maxiumum of 20 BEANS from the pool as they are activated and passivated as nescesary.

Dave
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!