1 / 12

EJB – Entity Beans

EJB – Entity Beans. By Richard, Ofosu And Mei, Junming. What is EJB?. EJB is a part of J2EE (java enterprise edition) specification. It is a server-side component that implements the business logic of an enterprise application

amanda
Download Presentation

EJB – Entity Beans

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 – Entity Beans By Richard, Ofosu And Mei, Junming

  2. What is EJB? • EJB is a part of J2EE (java enterprise edition) specification. • It is a server-side component that implements the business logic of an enterprise application • Provides the infrastructure for building enterprise-level server- side distributed Java components. • The idea behind EJB is that developers and designers are allowed to concentrate on the explicit issues and the business solution that they want to provide. • More implicit issues are handled by the application servers using EJB

  3. Types Of EJBs • There are three different types of EJB that are suited to different purposes: • Session EJB • A Session EJB is useful for mapping business process flow (or equivalent application concepts). • There are two sub-types of Session EJB • stateless :Allows concurrent access to beans. • stateful : Keeps track of which program they are dealing with • Entity EJB • An Entity EJB maps a combination of data (or equivalent application concept) and associated functionality. Entity EJBs are usually based on an underlying data store and will be created based on that data within it.

  4. Types Of EJBs • Message-driven EJB • A Message-driven EJB is very similar in concept to a Session EJB, but is only activated when an asynchronous message arrives. • As an application designer, you should choose the most appropriate type of EJB based on the task to be accomplished.

  5. Why Use EJB? • We can use simple Java Objects to develop applications that are smaller in size and requires less concurrent usage • As application complexity and the number of concurrent users grows, EJB makes it easier to scale and partition application. • EJB helps hide the complexities of applications.

  6. Why Use EJB? • EJB separates presentation logic from business logic • Application implemented using EJBs can provide access to some business functionality for other applications. Windows User Interface Database Access EJB Business Functionalities Web User Interface

  7. Why Use EJB? • EJB containers provides services such as: • Distribution via proxies—The container will generate a client-side stub and server-side skeleton for the EJB. The stub and skeleton will use RMI over IIOP to communicate. • Lifecycle management—Bean initialization, state management, and destruction is driven by the container, all the developer must do is implement the appropriate methods. • Naming and registration—The EJB container and server will provide the EJB with access to naming services. These services are used by local and remote clients to look up the EJB and by the EJB itself to look up resources it may need.

  8. Why Use EJB? • Transaction management—Declarative transactions provide a means for the developer to easily delegate the creation and control of transactions to the container. It Supports and manages ACID properties in transactions. • Security and access control—Again, declarative security provides a means for the developer to easily delegate the enforcement of security to the container. • Persistence (if you want)—Using the Entity EJB's container-managed persistence mechanism, state can be saved and restored without having to write a single line of code.

  9. Entity Bean • An Entity Bean is a business object that represents persistent data maintained in a database • They can survive a crash • Multiple clients can be using Entity Beans that represent the same data • The instance contains a copy of the data in the persistent store

  10. Features of Entity Bean • Persistence: Because the state of an entity bean is saved in a storage mechanism, it is persistent. • Persistence means that the entity bean's state exists beyond the lifetime of the application or the J2EE server process • Shared Access: Entity beans may be shared by multiple clients • Primary Key: Each entity bean has a unique object identifier. This uniquely differentiates instances • Relationships :Like a table in a relational database, an entity bean may be related to other entity beans. Example: A StudentEJB is Related to a CourseEJB

  11. Entity Bean Life Cycle At this point no instance of the object exists Server instantiates instances of bean and placed in a pool Bean is ready to accept client request

  12. REFERENCES • http://www.developer.com/java/ejb/article.php/10931_1434371_2 • http://en.wikipedia.org/wiki/Entity_bean • http://java.sun.com/j2ee/tutorial/1_3-fcs/doc/EJBConcepts4.html

More Related