Entity Settings

The Entity Setting page will only display when an entity-type bean is selected on the General page of the Enterprise Bean wizard. Use this page to select the type of persistence management that is supported by this bean. You must also provide the primary key class and, optionally, the primary key field name. If you are using container-managed persistence, choose the fields to be persisted. For EJB version 2.0 container-managed persistence, you may define the queries for handling finder and select methods.

Specify the Persistence Management Settings

Specify the type of management supported by your entity bean and its primary key class. Choose either or persistence management for the entity bean by selecting the appropriate option from the drop down menu. Select version 2.0 of container-managed persistence if you don't need to worry about compatibility with applications created with version 1.2 of the J2EE SDK because it supports relationships between EJBs. Select version 1.1 if you need to maintain backward compatibility with applications created with version 1.2 of the J2EE SDK.

If you selected container-managed persistence:

  1. Select the fields that you want to be persisted in the Fields To Be Persisted section by selecting the box to its left. These are the instance fields that the container will save in the data store. These fields must be either primitive types, Serializable objects, or remote reference types.

If you selected version 2.0 of container-managed persistence:

  1. In the Abstract Schema Name field enter the name of the entity bean's .
  2. Reference the abstract schema name in an statement by selecting the Find/Select Queries button. This displays the Finder/Select Methods dialog.

If you selected version 1.1 of container-manager persistence:

Click the Sun-specific Finder Queries button. This displays the Sun-specific Finder Queries dialog. Provide Sun-specific queries for Container-Managed Persistence Query Methods.

Specify the Primary Key

You choose the primary key class in the entity bean's deployment descriptor. In most cases, your primary key class will be a String, an Integer, or some other class that belongs to the J2SE or J2EE standard libraries. For some entity beans, you will need to define your own primary key class. For example, if the bean has a composite primary key (that is, one composed of multiple fields), then you must create a primary key class.

You have the following options to specify a primary key: