Object model technology is becoming more popular for building enterprise applications. Technologies which employ distributed objects allow client applications running on one computer to use objects on different machines. Objects can be transient, i.e., exist for a short period of time in a type of memory. Objects can also be persistent, i.e., committed to (i.e., stored in) a database. An object that is persistent can be accessed at any time and a system failure will not result in the loss of a persistent object.
Enterprise JavaBeans™ (EJB) is a component architecture for distributed systems. Objects used in an EJB architecture include entity beans. An entity bean represents persistent data. Each entity bean is identified by a primary key. Entity beans may be created, stored, modified and destroyed. The life-cycle of an entity bean begins just before its creation and ends just after its destruction.
Entity beans are persistent and thus may be shared by multiple clients and will survive a system failure or shutdown. Entity beans may have their persistence managed in two different ways: container managed persistence or bean managed persistence. Entity beans may have their attributes changes by transactions.
The EJB Specification of Sun Microsystems, Inc. (the EJB specification), defines a model for persistence for entity beans. Bean managed persistence (BMP) defines a persistence application program interface (API) that gives control over object life-cycle and object caching to the EJB server, and gives basic object persistence to the bean or persistent manager of the bean. Container managed persistence (CMP) gives the EJB server control of object life-cycle, object caching and persistence. An EJB server may also expose a CMP interface to a third party persistence manager, which is a proprietary API of the third party, and may follow the BMP model or may give more control to the persistence manager. The problem is that to provide an advanced object persistence solution (e.g., support for object caching, object change tracking, complex relationships, and inheritance), it is desirable that the persistence manager has control over object life-cycle and caching.
Providing an EJB server integrated CMP solution that gives the persistence manager control of object caching and object life-cycle is a prior solution. The EJB container in CMP can be proprietary of those creates EJB servers. Thus, the EJB container is EJB server dependent. Problems associated with this prior solution include the fact that an integrated CMP solution is not EJB server independent, and requires an extended persistence manager API that gives control over caching and object life-cycle to the persistence manager.
Providing a basic persistence BMP solution where the persistence manager does not have control of object caching and object life-cycle is another prior solution. Problems associate with this prior solution include the fact that a basic BMP solution does not provide support for advanced persistence, including object caching, object change tracking, relationships and inheritance.
Accordingly, there is a need for a way to provide a persistence manager control over the life-cycle of an object, such as entity bean, which is EJB server or other server independent, and that supports advanced persistence including object caching, object change tracking, relationships and inheritance.