Entity

Enterprise Bean Entity tabbed pane

The Entity tabbed pane allows you to edit the settings of an entity bean.

Bean-Managed Persistence Type

If the persistence management type of the bean is bean-managed persistence, skip to the section Defining Primary Key Class.

Version 2.0 Container-Manged Persistence Type

If the persistence management type of the bean is version 2.0 container-managed, perform the following steps:

  1. In the Fields To Be Persisted area, check the boxes next to the instance fields that the container saves in the data store. These fields must be either primitive types, Serializable objects, or Remote reference types.
  2. In the Abstract Schema Name field enter the name of the CMP entity bean's . This name is referenced in an Queries statement by selecting the Find/Select Queries button. This displays the Finder/Select Methods dialog.
  3. The EJB QL statements for the finder and select methods of an entity bean with container-managed persistence 2.0 can be specified in the Finder/Select Methods dialog. Click the Find/Select Queries button.
  4. To define the runtime CMP entity bean settings specific to Sun Java System Application Server, click the Sun-specific CMP Settings button.
  5. Define the primary key field class for the bean.

Version 1.1 Container-Managed Persistence Type

If the persistence management type of the bean is version 1.1 container-managed, perform the following steps:

  1. In the Fields To Be Persisted area, check the boxes next to the instance fields that the container saves in the data store. These fields must be either primitive types, Serializable objects, or Remote reference types.
  2. For CMP 1.1 entity bean, the Sun-specific Finder Queries dialog enables you to provide the JDO Query Language (QL) for Container-Managed Persistence Query Methods. JDO-QL enables the Bean Provider to specify the semantics of query methods in a portable way. Click the Sun-specific Finder Queries button.
  3. To define the runtime CMP entity bean settings specific to Sun Java System Application Server 8, click the Sun-specific CMP Settings button.
  4. Define the primary key class for the bean.

Define Primary Key Class

You can specify the primary key class in the entity bean's deployment descriptor. In most cases, your primary key class is 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. The primary key uniquely identifies the entity bean.

You have the following options to specify a primary key:

  1. Choose the option, Select an existing field to select a field from the available list of fields.
  2. Choose the option, Select an existing user defined class to select select the class of the entity bean's . For example, if the data contained in your primary key field is of type String, enter java.lang.String.
  3. Choose the option, Unknown primary key class, if the primary key field is not defined.
  4. In the Primary Key Class field, enter the class of the entity bean's . For example, if the data contained in your primary key field is of type String, enter java.lang.String in the Primary Key Class field.
  5. Select a variable name from the combo box labeled Primary Key Field Name.
  6. If you want your entity bean to be select the Reentrant checkbox. If your entity bean does not need callbacks, keep the default setting of .
  7. To define the bean's relationships with other entity beans, select the bean's EJB Jar in the Deployment Tool tree view (to the left in the primary window) and select the Relationships tab.

To define or edit the container-managed persistence properties of the EJB JAR file, click the CMP Database (Sun-specific Settings) button.

See also

Relationships

CMP Database

Sun-specific EJB Settings

Sun-specific Finder/Select Queries (CMP 1.1)

Sun-specific Finder/Finder/Select Methods (CMP 2.0)


Legal Notices