Understanding the automatic persistence architecture  Specifying the CMP version for EJB 2.0 entity beans

Chapter 27: Creating Entity Components

Configuring automatic or EJB CMP persistence

If you are developing EJB entity beans, use an EJB development tool to create an EJB-JAR file that defines the components’ CMP fields and container-managed relationships. You can define CMP entity beans in EAServer Manager, but it may be easier with a dedicated EJB development tool.

EAServer includes a sample EJB 2.0 CMP entity bean, in the installation subdirectory html/classes/Sample/cmp20sample. See the readme.txt file in this directory for instructions on deploying and running the sample.

When you have CMP entity beans defined in an EJB-JAR file, import the EJB-JAR file into EAServer as described in Chapter 9, “Importing and Exporting Application Components,” in the EAServer System Administration Guide. The JAR importer configures appropriate defaults for almost all settings. After importing, review the persistence settings described below and verify that they are correct.

To use automatic persistence for non-EJB entity components, you must configure the persistence properties in EAServer Manager.

Component properties for automatic persistence are configured on the Persistence tab in the Component Properties dialog box. This tab has subtabs to display the categorized properties.

StepsConfiguring automatic persistence

  1. Specifying the CMP version for EJB 2.0 entity beans.

  2. Setting Persistence/General subtab properties.

  3. Enabling automatic key generation if your entity component uses a table with an automatically generated key or your EJB entity bean uses java.lang.Object as the primary key class.

  4. Creating database tables.

  5. Configuring concurrency control.

  6. Setting field-mapping properties.

  7. Specifying finder- and ejbSelect-method queries.

  8. Configuring table-mapping properties.

  9. Using relationship components if using EJB 2.0 container-managed relationships.

After you have verified the deployment is working, you can optimize your component’s performance by configuring in-memory caching of instance data and query results. For more information, see “Entity instance and query caching” in the EAServer Performance and Tuning Guide.

Copyright © 2005. Sybase Inc. All rights reserved. Specifying the CMP version for EJB 2.0 entity beans