Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes 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 ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Paul Clapham
  • Jeanne Boyarsky
  • Ron McLeod
  • Frank Carver
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • fred rosenberger

Basic Ejb Question

Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I am new to EJB. When Iam trying to explore ,
Few basic questions are really troubling me in EJB. I would like to know whether my thinking is right .

1) For Statelss session beans , ejbCreate() will be called only once because of pooling.

2) For Statefull session beans ejbCreate() method will be called everytime as per request because we
cant pool.

3)Whether Stateless session beans can be accessed by multiple cleints.

4) Why multiple client access is not supported in Session beans, when session beans support transactions.
5)Whether the only main difference between Statefull session bean and Entity bean is the multiple client access support.

It will be thankfull to me if you people provide some light on above things with specific examples.


Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
All Enterprise Beans are pooled. What this means is when you start your server the number of instances available for a particular bean is governed by a property set in your deployment descriptor.
Since a Stateful Session Bean can hold state across multiple method calls, you can have a variety of ejbCreate() method signatures (with different argument lists).
Stateless Session Beans improve scalability, since it is associated to a client for a method call only. So by having fewer stateless session beans you can serve more clients, which you cannot do with stateful session beans as they are associated to a client as long as it stays alive.
Multiple Access is never provided to any Enterprise Bean. The state held by Stateful Session or an Entity Bean is with respect to a client.
Entity Beans model the data present in your database. Session Bean model your Business logic. If you use Container Managed Persistence, you are always assured that the data present in your database and that lying with your Entity Bean will be synchronised.
Hope this answers your doubts.
Weeds: because mother nature refuses to be your personal bitch. But this tiny ad is willing:
Garden Master Course kickstarter
    Bookmark Topic Watch Topic
  • New Topic