• Post Reply Bookmark Topic Watch Topic
  • New Topic

why use ejbcreate() in session beans  RSS feed

 
viswanath kasi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in session beans the ejbcreate() method is used to instantiate the bean. the same functionality is provided by the java constructor. then wat is the need to introduce this new method.
 
Pradeep bhatt
Ranch Hand
Posts: 8933
Firefox Browser Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that EJBs are remote objects. So new() would not work.

 
Chris Brat
Ranch Hand
Posts: 108
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stateless session beans live in a pool maintained by the container - in order to create the pool the container calls the beans constructor and sets the session context.

Any client needing to use a bean executes the create method to get an object implementing the remote component interface.
 
Avianu Sud
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so ejb's are not really instantiated, they are "picked" from a pool of already instantiated objects;thus ejbCreate() needed.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!