Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Basic Ejb Question  RSS feed

 
rajenag neelam
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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.

Thanks

Krishna
 
Vijayanand Viswanathan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!