Chapter 8 Creating J2EE Applications for BEA WebLogic


EJB Persistence Services

An entity EJB can save its state in any transactional or non-transactional persistent storage ("bean-managed persistence"), or it can ask the container to save its non-transient instance variables automatically ("container-managed persistence"). WebLogic Server allows both choices and a mixture of the two.

If an EJB uses container-managed persistence, the weblogic-ejb-jar.xml deployment file specifies the type of persistence services that an EJB uses. High-level definitions for automatic persistence services are stored in the persistence-type and persistence-use elements. persistence-type defines one or more automatic services that the EJB may use. persistence-use defines the actual service that the EJB uses at deployment time.

Automatic persistence services use additional deployment files to specify their deployment descriptors, and to define entity EJB finder methods. For example, WebLogic Server RDBMS-based persistence services obtain deployment descriptors and finder definitions from a particular bean using the bean's weblogic-cmp-rdbms-jar.xml file, described in Using WebLogic Server RDBMS Persistence.

Third-party persistence services may use other file formats to configure deployment descriptors. However, regardless of the file type, the configuration file must be referenced in the persistence-type and persistence-use elements in weblogic-ejb-jar.xml.

Note: Container-managed persistence beans need to be configured with a connection pool with maximum connections greater than 1. This is because WebLogic Server's container-managed persistence service may sometimes need to get two connections simultaneously.

 


Copyright (C) 2005. Sybase Inc. All rights reserved.