Jakarta Enterprise Beans

From Simple English Wikipedia, the free encyclopedia

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[change | change source]

Looking 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 | change source]