Java EE Business Components

EJB defines a model for building server-side, reusable components and it is a major part of the J2EE specification. Three types of enterprise beans supported by J2EE which are very well known as - session beans, entity beans and message-driven beans.


Figure 1:- Types of Beans
1.      Session beans are considered as extensions to the client application and used to model the different business processes. These session beans are further divided into two types - stateful and stateless. Stateful session beans(Single client) are used to record conversational state for a single client between requests and stateless session beans(multiple Clients) are shared between any numbers of clients at any one time.
2.      Entity beans are used to model persistent business entities for example data in a database. For a common mapping is to model an entity bean on a table, there being one instance of that bean for every row in the table. For achieving the persistence, there are two different methods - container managed and bean managed persistence. In container managed persistence, a mapping is defined at deployment time between the persistent properties in the bean and the columns in the table while in bean managed persistence, developers write the JDBC code that performs the create, read, update and delete operations.
3.      Message-driven beans allow functionality to be executed on an asynchronous basis, when triggered by JMS messages, a message-oriented middleware.
 Some Basic features of EJB :-
      Server-side components, modular, reusable, and having specific units of functionality
      Similar to the Java classes,  but are subject to special restrictions and must provide specific interfaces for container and client use and access
   •      Used for applications that require scalability, transactional processing, or availability to multiple         client types. 

Figure 2: EJP Architecture

No comments:

Post a Comment