Container-managed persistence features

The container-managed persistence (CMP) features include those defined by the EJB 2.0 Specification, as well as capabilities that are beyond the specification.

 

EJB 2.0 specified capabilities

Container-Managed Relationships (CMR) is one of the most significant new features added by the EJB 2.0 Specification. Like Inheritance, relationships are a key component of object-oriented software development and non-trivial object models can form complex networks with these relationships. The EJB 2.0 Specification adds relationships to the EJB programming model and requires that the container be responsible for their maintenance.

The container automatically manages the state of CMP entity beans. This management includes synchronizing the state of the bean with the underlying database when necessary and also managing any relationships (CMRs) with other entity beans. The bean developer is relieved of writing any database specific code and, instead, can focus on business logic.

Local interfaces are another feature introduced in the EJB 2.0 Specification. Local component interfaces allow co-located beans to interact without the overhead associated with remote access.

 

Value-add features

Several capabilities are provided to enhance the function of CMP entity beans that go beyond those capabilities defined by the specification. These include...

Entity bean inheritance Inheritance is a key aspect of object-oriented software development and is a capability currently missing from the EJB 2.0 Specification.

The use of inheritance enables a developer to define fields, relationships, and business logic in a superclass entity bean that are inherited by all subclasses. See the section EJB inheritance of the WebSphere Studio Application Developer (WSAD) documentation for details on using inheritance with WebSphere Application Server and entity beans.

Access Intent Policies Access intent policies provide J2EE application developers the mechanism by which they can indicate the intent of an application's interaction with the essential state for entity beans in order that the persistence mechanisms can make appropriate optimizations. For example, if it is known that an entity is not updated during the course of a transaction, then the persistence management is able to ease up on the concurrency control and still maintain data integrity by disallowing update operations on that bean for the duration of the transaction.

Caching data across transactions Data caching across transactions is a configurable option set by the bean deployer that can greatly improve performance. Essentially, this is for data that changes infrequently. The option is known as LifetimeInCache. The data for an entity configured for lifetime in cache is stored in a cache until its specified lifetime expires. Requests on the entity during that configured lifetime use the cached data, and do not result in the execution of queries against the underlying data store. Lifetime can be expressed as time elapsed since the data was retrieved from the data store or until a specific time of day or week.

See the LifetimeInCache help sections of the Assembly Toolkit (ATK) for more details.

 

See Also

Access intent policies
Data access : Resources for learning