Entering content frame

Procedure documentation Creating the Bean's Persistent Fields Locate the document in its SAP Library structure

Use

You can create the container-managed persistent fields (cmp-fields) of a container-managed entity bean when you create the enterprise bean, or later when you develop the bean’s business logic.

When you create the persistent fields, the NetWeaver Developer Studio automatically generates the corresponding accessor methods (get and set accessor methods), through which the persistent fields are accessed.

Prerequisites

The enterprise bean must have been created.

Procedure

       1.      From the J2EE Explorer pane, choose your EJB Project ® ejb-jar.xml ® the enterprise bean whose persistent fields you want to create

       2.      From the context menu, choose Open.

The right-hand pane displays the bean properties.

       3.      Choose the Fields tab.

       4.      Select the Persistent Fields node and choose Add.

The new persistent field appears as sub-node under the Persistent Fields tree structure.

       5.      Select the persistent field and enter the following data:

 

Property

Description

Name

The name of the persistent field.

The NetWeaver Developer Studio will use this name to create the corresponding get and set accessor methods in the bean’s source code by capitalizing the first letter of the persistent field name and adding get or set in front of it.

Fully Qualified Name

The fully qualified name of the type of the persistent field. That is, the name must specify the package of the type, too.

For more information about the fully qualified name of dependent-value persistent fields, see Creating Dependent-Value Persistent Fields.

Array

Choose this option to specify that the persistent field is an array of the specified type. Enter the dimension of the array in the field that appears when you choose the Array option. The value of the dimension must be between 1 and 9.

 

       6.      To specify an optional description for the persistent field, proceed as follows:

...

                            a.      Open the ejb-jar.xml.

                            b.      From the right-hand pane, choose the Enterprise Beans tab.

                            c.      Open the entity beans tree structure.

                            d.      From your bean tree sub-structure, select cmp-field ® the corresponding cmp-field.

The persistent fields created in the bean are automatically loaded as sub-nodes in the cmp-field tree structure.

                            e.      Enter the description for your field in the corresponding field.

Result

The persistent fields are described in the ejb-jar.xml deployment descriptor. Their O/R mapping is described in the SAP J2EE Engine-specific deployment descriptor persistent.xml.

 

See also:

Database Mapping

Creating Primary Keys

Creating Dependent-Value Persistent Fields

 

 

Leaving content frame