Discuss this tutorial. Printable version (PDF).
Go to Contents page. Go to previous page. Go up a level. Go to next page.

 

Concepts


An entity bean models a business entity and performs actions within a business process. For example, you could implement an entity bean to retrieve and perform computation on line items within a purchase order. Entity beans survive beyond the end of an application session, even a server crash or a network failure, because the data is stored by the container in some form of data storage system, such as a database.

The EJB specification defines the following persistence mechanisms for entity beans:

  • Bean-manged persistence (BMP), where data is stored and retrieved programmatically through methods implemented implemented by the bean developer. These methods typically use JDBC or SQLJ to manage persistence.

  • Container-managed persistence (CMP), where the container handles persistence chores automatically.

Container-managed persistence keeps an entity bean class separate from its persistent representation, enabling developers to change a bean's data source without affecting its implementation. With CMP, instead of writing Java code to implement bean-managed persistence, you describe container-managed persistence declaratively in the deployment descriptor file (for an example from the FBS 10g, see ibfbs\etc\ejb-jar.xml). When a bean is deployed, the container provider's tools parse the deployment descriptor and generate code to implement the underlying classes. See the Design and Implementation sections of this tutorial for more information and examples.

At runtime, the container manages the bean's data by interacting with the datasource, typically a relational database, designated in the deployment descriptor. If the persistent data is saved to or restored from a database, you must ensure that the correct tables exist for the bean—if you use OC4J, you can configure the container to create such tables automatically.


Discuss this tutorial.

Printable version (PDF).

Go to Contents page. Go to previous page. Go up a level. Go to next page.

E-mail this page
Printer View Printer View
Oracle Is The Information Company About Oracle | Oracle RSS Feeds | Careers | Contact Us | Site Maps | Legal Notices | Terms of Use | Privacy