Jakarta Enterprise Beans
Jakarta Enterprise Beans are standardized components inside the Java Enterpise framework. They used to be called Enterprise Java Beans but they were renamed. They make it easier to build multi-tier applications, which can also be distributed. EJBs are a server-side components, that are used for the business logic of an application.
There are three different types of these beans:
- Entity beans model entities of a database. One such bean has the informartion of one database record.
- Session beans model the interactions with the system.
- Message-driven beans are there to model messaging systems. This also makes it possible to decouple different systems. The system sending the message does not need to know how to process it.
EJBs also support other Enterprise Java features such as managing transactions, when needed.
Practical example
changeLooking at a simple example of a online shop, it is possible to define the different tasks: A client comes along and performs some searches. The result of these searches are stored in stateless session beans. The client then goes, and buys different products. The "shopping cart" is modeleled as a stateful session bean. When the client checks out the goods, some data needs to be recorded, such as where to send the goods, or what method of payment to use. This data is later persited to a database, the client will get a way to log in. Usually, entity beans are used for this. To actually perform the checkout, message-driven beans are often used (for example to check if the credit card number is valid, or if the credit card can be used for payment. Finally, the sending of the goods needs to be provided, which is often done by sending messages to other systems.
When they are done in Java, so-called web-services are done using stateless session beans
Other websites
change- Sun's EJB Product main page
- EJB 3.0 API Javadocs
- The EJB 3.0 Specification
- Sun's EJB 3.0 Tutorial
- EJB (3.0) Glossary
- JSR 318 (EJB 3.1)
- JSR 220 (EJB 3.0)
- JSR 153 (EJB 2.1)
- JSR 19 (EJB 2.0)
- EJB 2 example based tutorial issa Archived 2009-02-17 at the Wayback Machine