Hi Friends........
What is the difference between the entity bean and session bean..........
Thanks..........
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Nov 30, 2011, 9:55 PM
Bean Class
This class contains logic for the methods present in home and remote interfaces. Whenever the clients call any method of home and remote interface, then the EJB container calls the corresponding method available method available in bean class. The bean class can be three types they are as below
1.Session bean
2.Entity bean
3.Message driven bean
Session bean
Such type of bean implements business logic in the application layer. This bean can perform all types of operations or calculation required for an application. This bean can contain state of the user for a period or session. If the state can be available for only one transaction then it is called as stateless session bean. If the state can be available for more than one transaction then it is called as state full session bean. A session bean can be created by inheriting javax.ejb.SessionBean interface.
Entity Bean
This bean can be created to implement persistence logic. Persistance logic means creation and maintenance of data in Dbms.This bean can contain state of the user forever. If the persistency logic is being implemented by the bean class explicitly then it is called as bean managed persistency. If the persistency logic gets implemented by the Ejb container then it is called as container managed persistency. An entity bean can be created by inheriting javax.ejb.EntityBean interface.
Difference
Session Bean: Session is one of the EJBs and it represents a single client inside the Application Server. Stateless session is easy to develop and its efficient. As compare to entity beans session beans require few server resources. A session bean is similar to an interactive session and is not shared; it can have only one client, in the same way that an interactive session can have only one user. A session bean is not persistent and it is destroyed once the session terminates. Entity Bean: An entity bean represents persistent global data from the database. Entity beans data are stored into database.
Thanks
Vikas MishraPosted Dec 3, 2011, 3:05 AM