1 / 24

EJB By: Sirisha Panchagnula Dt:11/04/03

EJB By: Sirisha Panchagnula Dt:11/04/03. Introduction Why EJB? When To Use EJB? Where does EJB Run? Differences between Java beans &EJB Basic EJB Architecture What Does EJB Consist? EJB Architecture Revisited EJB Components EJB Container for Session N Entity Beans. Types of EJB’s

ranee
Download Presentation

EJB By: Sirisha Panchagnula Dt:11/04/03

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. EJB By: Sirisha Panchagnula Dt:11/04/03

  2. Introduction Why EJB? When To Use EJB? Where does EJB Run? Differences between Java beans &EJB Basic EJB Architecture What Does EJB Consist? EJB Architecture Revisited EJB Components EJB Container for Session N Entity Beans Types of EJB’s EJB With Session & Entity Beans What is Entity Bean? Persistence in Entity Bean What is Session Bean? Stateful & Stateless Beans Entity Bean Vs Session Bean Life Cycle Of EJB Roles In EJB Cycle Index

  3. Introduction • Enterprise Java Beans is a specification for creating server-side scalable, transactional, multi-user secureenterprise-level applications. • It provides a consistent component architecture framework for creating distributed n-tier middleware. • EJB enables rapid and simplified development of distributed, transactional, secure and portable Java applications.

  4. Why Enterprise Java Beans? • Architectural Independence for developers • WORA (Write Once, Run Anywhere) for server side components (Portable Components) • Establishes roles for application development • Takes care of Transaction Management • Provides Distributed Transaction support • Helps create Portable & Scalable solutions • Integrates seamlessly with CORBA • Provides vendor specific enhancements. • Location Transparent

  5. When To Use EJB? • Applications should be scalable • Applications that contain business logic that operates on Enterprise’s data. • Transactions should ensure data integrity • Applications should have variety of clients. • Clients can be thin & numerous.

  6. Where Does EJB Run?

  7. Differences Between Java Beans & EJB’s

  8. BASIC EJBARCHITECTURE

  9. What Does EJB Consist • A typical EJB Architecture consists of* An EJB server, * EJB containers that runs on these servers, * EJBs that run in these containers, * EJB clients and other auxiliary systems like the Java Naming and Directory Interface (JNDI),Java Transaction Server(JTS) * The EJB Home interface and Home object * The Remote interface and EJBObject

  10. EJB Architecture Revisited

  11. EJB Components • EJB Servers :Analogous to the CORBA ORB. • Provides the system services like ( raw execution environment), ( multiprocessing), ( load-balancing ) , ( device access ) • Provides naming transaction services • Makes containers visible. • EJB Clients :Use EJB Beans for their operations. • Find the EJB container that contains the bean through the Java Naming and Directory (JNDI) interface. • Use the EJB Container to invoke EJB Bean methods. • EJB Containers :Act as the interface between an Enterprise Java Bean and the outside world. • EJB client never accesses a bean directly.

  12. Components Con’t • Any bean access is done through container-generated methods which in turn invoke the bean's methods. • The EJB Home interface and Home object : • Factory methods for (locating) (creating) (removing instances of EJB classes) are defined here. • The Home object is the implementation of the Home interface • The Remote interface and EJBObject: • Lists the business methods available for the enterprise Bean. • The EJBObject is the client’s view of the enterprise Bean • It implements the remoteinterface. • The Enterprise Java Bean:The real EJB Bean itself is contained within an EJB container, and should never be directly accessed other than the container.

  13. EJB Container For Session & Entity Beans

  14. Types Of EJB’s

  15. EJB Environment With Session & Entity Beans

  16. What is Entity Bean • Entity Beans always have states. • Can be shared by multiple EJB Clients. • Their states can be persisted and stored across multiple invocations. • Hence they can survive System Shutdowns. • EJB servers have a right to manage their working set. • Passivation is the process by which the state of a Bean is saved to persistent storage and then is swapped out. • Activationis the process by which the state of a Bean is restored by swapping it in from persistent storage. • Passivation and Activation apply to both Session and Entity Beans

  17. Persistance in Entity Beans • Persistence in Entity Beans is of two types. They are: • Container-managed persistence:Here, the EJB container is responsible for saving the Bean's state. Hence the implementation is independent of the data source. • Bean-managed persistence:Entity bean directly responsible for saving its own state. Implementation less adaptable than the previous one.

  18. What Is Session Bean? • As its name suggests, a session bean is similar to an interactive session. A session bean is not shared Like an interactive session, a session bean is not persistent • There are two types of session beans: stateful and stateless. • Stateless Session Beans:These types of EJBs have no internal state. Since they do not have any states, they need not be passivated • Because of the fact that they are stateless, they can be pooled to service multiple clients

  19. Stateful Session Beans • These have internal states. Hence need to handle Activation and Passivation. Also called Persistent Session Beans. • These types of EJBs can be saved and restored across client sessions. • To save, a call to the bean's getHandle()method returns a handle object. To restore call getEJBObject() method

  20. Session Bean Entity Bean The data members of the session bean contain conversational state. The data members of the entity bean represent actual data in the domain model. A session bean may handle database access for a single client. Entity beans share database access for multiple clients. Because session beans are about a conversation with a single client, session beans are allowed to store per-client state information.. Because entity beans are shared between multiple clients, they do not allow storage of per-client state information. The relationship between a session bean and its client is one-to-one. The relationship between an entity bean and a row in the domain model is one-to-one. The life of the session bean is limited to the life of its client. An entity bean persists as long as the data exists in the database. Session beans can be transaction aware. Entity beans are transactional. Session beans do not survive server crashes. Entity beans survive server crashes. Entity Bean Vs Session Bean

  21. Life Cycle Of EJB

  22. Roles in EJB Cycle • EJBBean Provider –Developers who create enterprise beans • Application Assembler - uses the EJB • EJB Deployer - deploys the EJBs on a Server • EJB Server Provider - creates EJB Servers • EJB Container Provider - creates EJB containers and tools • System Admin: Ensures server is available to other network services • Ensures the servers are configured correctly to handle user loads.

  23. References • http://my.execpc.com/~gopalan/ • Java FAQ • Ejb Concepts by Sun

More Related