1 / 19

Enterprise Java Beans (EJB)

Enterprise Java Beans (EJB). Enterprise Java Beans EJB Architecture Types of EJB. Where they fit in a system. Using EJB’s. Clients. Enterprise JavaBeans Architecture. The EJB architecture specifies the responsibilities and interactions among EJB entities. EJB Servers. EJB Containers.

Download Presentation

Enterprise Java Beans (EJB)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Enterprise Java Beans (EJB)

  2. Enterprise Java Beans • EJB Architecture • Types of EJB.

  3. Where they fit in a system

  4. Using EJB’s

  5. Clients Enterprise JavaBeans Architecture The EJB architecture specifies the responsibilities and interactions among EJB entities • EJB Servers • EJB Containers • Enterprise Beans • EJB Clients Enterprise Bean Enterprise Bean EJB Container EJB Server

  6. EJB Server EJB Server Provides a Runtime Environment • The EJB Server provides system services and manages resources • Process and thread management • System resources management • Database connection pooling • Management API

  7. EJB Container EJB Server EJB Container Provides a Run-time Environment for an Enterprise Bean • Hosts the Enterprise JavaBeans • Provides services to Enterprise JavaBeans • Naming • Life cycle management • Persistence (state management) • Transaction Management • Security

  8. Enterprise Bean Enterprise Bean EJB Container EJB Server Enterprise Beans • A specialized Java class where the real business logic lives • May be developer-written or tool-generated • Distributed over a network • Transactional • Secure • Server vendors provide tools that automatically generate distribution, transaction and security behavior

  9. Enterprise Bean Enterprise Bean EJB Container EJB Server Clients EJB Clients • Client access is controlled by the container in which the enterprise Bean is deployed • Clients locates an Enterprise JavaBean through Java Naming and Directory Interface (JNDI) • RMI is the standard method for accessing a bean over a network

  10. JavaBeans vs EJB • Enterprise JavaBeans is a framework for building and deploying server-side Java components • JavaBeans is a framework for client-side Java components • Conceptually related because both are components • The specifications do not build on each other.

  11. Three kinds of EJB’s • Session • associate client information with a specific client • both stateless and stateful versions • Entity • groups associated information in an abstraction that provides transaction support • Message Bean - rarely used, hardly supported

  12. What is a Session Bean? • Represents a single Client inside the J2EE server • one client at a time/ not persistent • when the client terminates, the session bean is disassociated from the client • There are two types: Stateful and Stateless...

  13. Stateful • These represent a set of interactions between client and server. • Example: shopping cart • Saves information over several method invocations. • There is a lot of overhead associated with using stateful beans

  14. Stateless • A stateless bean does not save information between method calls. • Limited application • Little overhead • multiple clients can use the same bean instance without alteration • Example: fetch from a read-only database or send a confirmation email for an order

  15. Entity Beans • Associates pieces of information in a group • Accessed by multiple clients at a time • Persistent and Serializable • The container loads and stores the entity beans in the database • These are more similar to regular beans

  16. Persistence in Entity Beans • Container Managed Persistence (CMP) • the container controls when the bean is read from or written to the database • Bean Managed Persistence (BMP) • the bean’s implementation performs all of the SQL operations that loads, stores, and updates the bean’s data to or from the database. • Bean is responsible for connection allocation to the database

  17. Mandatory for EJB 1.0 Represents a specific client(1 instance per client) Short-lived Transient Can be any Java class May be transactional Business Logic Beans Optional for EJB 1.0 Represents underlying data object or context(clients share instance) Long-lived Persistent Can be a class that maps to persistent data (e.g., database) Always transactional Beans which represent data Comparing Session and Entity Beans Session Beans Entity Beans

  18. Message Beans • A message bean is an enterprise bean that allows J2EE applications to process messages asynchronously. It acts as a JMS(Java Messaging Services) message listener, which is similar to an event listener except that it receives messages instead of events. • Many systems do not yet support JMS, message bean use is currently not widespread

  19. THANKS

More Related