Required Classes/Interfaces That Must Be Provided for an Enterprise JavaBeans Component

By: Paul Allen and Joseph Bambara Emailed: 1675 times Printed: 2157 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

Here we review the component architecture of EJBs. We also cover the required classes and interfaces for EJB, which include the home and remote interfaces, the XML deployment descriptor, the business logic (bean) class, and the context objects. While these names may or may not be meaningful to you at this point, you will soon understand how each of these pieces fits into the EJB component model.

Classes and Interfaces for EJB

The components used to create and access EJBs facilitate the creation and execution of business logic on an enterprise system. Each EJB session and entity bean must have the following classes and interfaces:

  • Home (EJBHome) interface

  • Remote (EJBObject) interface

  • XML deployment descriptor

  • Bean class

  • Context objects

Home (EJBHome) Interface

The EJBHome object provides the lifecycle operations (create(), remove(), find()) for an EJB. The container’s deployment tools generate the class for the EJBHome object. The EJBHome object implements the EJB’s home interface. The client references an EJBHome object to perform lifecycle operations on an EJBObject interface. The Java Naming and Directory Interface (JNDI) is used by the client to locate an EJBHome object.

The EJBHome interface provides access to the bean’s lifecycle services and can be utilized by a client to create or destroy bean instances. For entity beans, it provides finder methods that allow a client to locate an existing bean instance and retrieve it from its persistent data store.

Remote (EJBObject) Interface

The remote (EJBObject) interface provides access to the business methods within the EJB. An EJBObject represents a client view of the EJB. The EJBObject exposes all of the application-related interfaces for the object, but not the interfaces that allow the EJB container to manage and control the object. The EJBObject wrapper allows the EJB container to intercept all operations made on the EJB. Each time a client invokes a method on the EJBObject, the request goes through the EJB container before being delegated to the EJB. The EJB container implements state management, transaction control, security, and persistence services transparently to both the client and the EJB.

XML Deployment Descriptor

The deployment descriptor is an XML (Extensible Markup Language) file provided with each module and application that describes how the parts of a J2EE application should be deployed. The deployment descriptor configures specific container options in your deployment tool of choice.

The rules associated with the EJB that govern lifecycle, transactions, security, and persistence are defined in an associated XML deployment descriptor object. These rules are defined declaratively at the time of deployment rather than programmatically at the time of development. At runtime, the EJB container automatically performs the services according to the values specified in the deployment descriptor object associated with the EJB.

Business Logic (Bean) Class

The bean class is developed by the bean developer and contains the implementation and the methods defined in the remote interface. In other words, the bean class has the basic business logic. For entity and session beans, the bean class extends either javax.ejb.SessionBean or javax.ejb.EntityBean, depending upon the type of EJB required.

Context Objects for Session and Entity

For each active EJB instance, the EJB container generates an instance context object to maintain information about the management rules and the current state of the instance. A session bean uses a SessionContext object, while an entity bean uses an EntityContext object. Both the EJB and the EJB container use the context object to coordinate transactions, security, persistence, and other system services.


EJB Home | All EJB Tutorials | Latest EJB Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Paul Allen and Joseph Bambara
Managing Security in EJB
Difference Between Stateful and Stateless Session Beans
Difference Between Session and Entity Beans
Required Classes/Interfaces That Must Be Provided for an Enterprise JavaBeans Component

More Tutorials in EJB
EJB 3 Entities
Web services basics
Required Classes/Interfaces That Must Be Provided for an Enterprise JavaBeans Component
Difference Between Session and Entity Beans
Difference Between Stateful and Stateless Session Beans
Managing Security in EJB
EJB Entity Beans
Types of EJB

More Latest News
Most Viewed Articles (in EJB )
Difference Between Stateful and Stateless Session Beans
Difference Between Session and Entity Beans
Types of EJB
EJB Entity Beans
Managing Security in EJB
Required Classes/Interfaces That Must Be Provided for an Enterprise JavaBeans Component
Web services basics
EJB 3 Entities
Most Emailed Articles (in EJB)
Difference Between Session and Entity Beans
Difference Between Stateful and Stateless Session Beans
Managing Security in EJB
Web services basics
EJB 3 Entities
Types of EJB
Required Classes/Interfaces That Must Be Provided for an Enterprise JavaBeans Component
EJB Entity Beans