Well then one might think what is the difference between CMP which is Container Managed Persistance and BMP which is Bean Managed Persistance.
Well then Container Managed Persistance, the container manages the Beans Persistance that Beans sorry Means that even after the client module is shut down the bean is persisted untill the container deicded to destroy the bean.
In Bean Managaed Persistance, the developer, are required to manage all the manipulation to your given data source.
Entity are a single representation unlike session that are multiple instance of data. When the client invokes the create() method on the home interface, the bean is then created and placed within the pool of available beans. This pool contains all currently instantiated entity beans of this type. In the sequence diagram, you will see that the transition from Does not exist to pooled varies between BMP and CMP.
At some point, the container may decide to "garbage" collect pooled beans. The container calls unsetEntityContext() to deallocate the current associated entity of data. The EJB specification does not define the frequency or trigger for this action to execute, only that the bean must have the capability to accomplish this. In other words, different vendors trigger the garbage collector at different times. For example, Borland's Enterprise Server executes it on the length of inactivity of the bean.
If the client then invokes one of the finder methods, the bean finds the instance of the data in the data source, copies the primary key into the instance's member variables, and finally returns the bean to the pool. In many instances, this does not cause the entire instance to be loaded into the entity bean. This happens when the ejbLoad() method is called to synchronize the data with the data source.
No comments:
Post a Comment