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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 30, 2011, 4:55 PM EST
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 MishraRank #559 · 4.3K reputationPosted Dec 2, 2011, 10:05 PM EST