Here is a rule of thumb. If your application is so complicated that it will have to be distributed over several servers, have a look at EJB. If not, use a simpler technology.
Enterprise beans don’t have a GUI interface. Enterprise Java Beans speak CORBA IIOP for their RMI. Session Beans maintain conversational context for one client. Entity beans cache data for one row of a database. Entity beans also provide a simple persistent object database, indexed by a primary key. The Entity bean learns its primary key at create time, and may persist indefinitely. Beans make it easier to implement transaction logic with commit/rollback. The transaction processing logic helps keeps beans from interfering with each other. EJBs use JNDI to find objects. They use RMI (regular or IIOP Corba) to communicate between servers. They use JTA for transaction management.
The point of EJB is to fob much of the work of concurrency, transaction handling and persistence off on the container so the beans can concentrate on business logic.
There are several types of beans. This diagram outlines them:
Beans communicate via two proxy objects, one that implements the bean’s home (bean-finding) interface and one that implements its remote (business-logic) interface. The indirection allows the EJB container to intercept the calls and add functionality such as persistence.
Using EJBs also takes away a number of things. You are not allowed to do certain things within the EJB container. E.g., you should not create threads, do file IO, listen on a socket, etc.
![]() |
recommend book⇒Building Java Enterprise Applications Volume I: Architecture | |||||||||||||||||||||
| paperback | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ISBN10: | 0-596-00123-1 | |||||||||||||||||||||
| ISBN13: | 978-0-596-00123-0 | |||||||||||||||||||||
| publisher: | O’Reilly | |||||||||||||||||||||
| published: | 2002-03 | |||||||||||||||||||||
| by: | Brett McLaughlin | |||||||||||||||||||||
| Aimed at experienced developers. Filled with particularly good advice on using EJBs and LDAP directory services Highly recommended. First volume of a three volume set on J2EE. | ||||||||||||||||||||||
| ||||||||||||||||||||||
![]() |
recommend book⇒Enterprise Java Beans | |||||||||||||||||||||
| paperback | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ISBN10: | 1-56592-605-6 | |||||||||||||||||||||
| ISBN13: | 978-1-56592-605-9 | |||||||||||||||||||||
| publisher: | O’Reilly | |||||||||||||||||||||
| published: | 1999-06 | |||||||||||||||||||||
| by: | Richard Monson-Haefel | |||||||||||||||||||||
| ||||||||||||||||||||||
![]() |
and suggestions to improve this page to Roedy Green : | ||
| Canadian Mind Products | |||
| mindprod.com IP:[65.110.21.43] | |||
| Your face IP:[38.103.63.18] | ![]() | ||
| You are visitor number 17,802. | |||
| You can get a fresh copy of this page from: | or possibly from your local J: drive (Java virtual drive/Mindprod website mirror) | ||
| http://mindprod.com/jgloss/ejb.html | J:\mindprod\jgloss\ejb.html | ||