File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes Entity EJB and Session EJB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Entity EJB and Session EJB" Watch "Entity EJB and Session EJB" New topic

Entity EJB and Session EJB

fei long
Ranch Hand

Joined: Apr 04, 2002
Posts: 48
I am a newer of EJB. Could you tell me what's the difference between Entity EJB and Session EJB. And why should we use EJB in web application. If you guys can give me some example. That would be great.
Malli Raman
Ranch Hand

Joined: Nov 07, 2001
Posts: 312
1. Reason for using the EJB:
a. To seperate the Business logic.
b. To create a Distributed component.
c. To maintain the security, transaction, naming services by the EJB container. Here in this case we don't need to bother about the above said criteria.
2. Difference between Entity Bean and Session Bean:
a. Entity Bean acts as a model for real time objects. i.e. Any real time objects can be a entity bean which persists the data in the storage medium.
b. Session bean is extends to the client action. i.e. It will the decide the work flow. It won't be stored in the storage medium.
fei long
Ranch Hand

Joined: Apr 04, 2002
Posts: 48
thanks Malli Subramanian Raman!
Actually, i am doing a web application projects.
I want to write codes about maintain customer's information and order information which is stored in database. Is it necessary to write EJB for these manipulation?(such as OrderBean, CustomerBean) If necessary, session or entity EJB should i use?
Kyle Brown
Ranch Hand

Joined: Aug 10, 2001
Posts: 3892
Hi. You probably want to read one of the many good books on EJB architecture. I would suggest "Core J2EE" by Deepak Alur, et. al., or "EBJ Design Patterns" by Floyd Marinescu. In the meantime, take a look at this article and this article for a little more guidance. Another good source of information is the Sun Blueprints for J2EE. All of the resource referenced above should help clarify your understanding of the proper role and use of each type of EJB.

Kyle Brown, Author of Persistence in the Enterprise and Enterprise Java Programming with IBM Websphere, 2nd Edition
See my homepage at for other WebSphere information.
I agree. Here's the link:
subject: Entity EJB and Session EJB
It's not a secret anymore!