The Artima Developer Community
Sponsored Link

Legacy Design Forum
Composition Versus Inheritance

Advertisement

Advertisement

This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

Session and Entity Beans

Posted by Dac Cu on July 29, 2001 at 3:03 AM

> > > How to go about deciding whether to use session beans and entity bean?
> > > How to distrubute the responsibilties?
> > >what is the difference between stateful and stateless beans?

> Ans For 1 and 3
> 1) Session Bean:
> session bean is a bean which is used for the perticular client session. If the client quit the application the session will finish.And it will not maintain the state of the client.It is not persitant. So Go for the session bean when you don't want to maintain the state of the application.

> Entity Bean:
> Entity Bean are those beans which maintain the state for the client.And it's transcation are maintain in the database.So go for the Entity bean when you want to maintain state and information in the database.

In general session bean is representing a client on the server side. However, only statefull session bean maintaining a state between the client and server. Stateless session bean is not. after it completes the work for the client it is removed from a instance pool.

For the entity bean, you can think of it as a relational object maping to a row of a table. And there are two type of them; bean-managed and container-managed entity beans. bean-managed entity bean means you have to write the code for inserting, updating, and deleting rows from a table, in constract, the container-managed does the work for you. However, you have to define variables maping to records in a table.
Hope it help.




Replies:
  • anand anand October 30, 2001 at 8:35 AM (0)

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us