EJB 3.0 : Stateless Session Bean
What is Stateless Session Bean? |
Stateless session EJBs have the following behaviour:
- provide a single use service
- do not maintain state on behalf of the client
- are relatively short lived
- do not survive EJB server crashes
- any two instances of the same stateless session EJB type are always identical
- each instance can be shared by multiple clients
When to use Session Beans?
Session beans are typically used for business process or control logic that spans multiple entity beans
Life Cycle of Stateless Session Bean
- Does not Exist
- Ready State
Interaction between Client, Bean instance, Container for Stateless Session Bean
Sequence of Operations initiated by Client
- Client calls a create() method on the home object
- Home object requests a bean instance from a pool, home object returns EJB object to client
- Client calls business methods on EJB object
- EJb object passes the call to Bean instance
- Client calls remove() on the EJB object
- EJB object releases bean instance
Sequence of Operations initiated by Container (independent from Client action)
- Create Bean instance
- Container calls setSessionContext() of the bean
- Container calls ejbCreate() of the bean
- Container calls ejbRemove() of a bean
- remove
Example for Stateless session Bean |
Click Here to Download the code
Stateless Session Bean Deployment
Now Start The Weblogic Server 10
Now, Start the Weblogic Server Administrator console.
http://localhost:7001/console
Run the Client Program to test your Stateless Session bean deployed on weblogic server.
Recent Comments