uCosminexus Application Server, Application Setup Guide

[Contents][Index][Back][Next]

9.6.2 Mapping CMP1.x and the database

This section explains the mapping of the fields of a CMP1.x Entity Bean to a table in the database.

Organization of this subsection
(1) Attribute file to be edited
(2) Acquiring the attribute file to be edited and setting the attributes
(3) Attribute settings to be edited
(4) Notes

(1) Attribute file to be edited

Entity Bean attribute file

(2) Acquiring the attribute file to be edited and setting the attributes

Acquiring the attribute file

Execute the following command to acquire an Entity Bean attribute file:

Execution format
 
cjgetappprop [server-name] [-nameserver provider-URL] -name J2EE application-name -type ejb -resname EJB-JAR-display-name/Entity-Bean-display-name-c path-of-the-Entity-Bean-attribute-file
 

Example of execution
cjgetappprop MyServer -name adder -type ejb -resname account/MyAccoub -c C:\home\adder_ejb.xml
 
Setting the attributes

Execute the following command to apply the values of the Entity Bean attribute file:

Execution format
 
cjsetappprop [server-name] [-nameserver provider-URL] -name J2EE application-name -type ejb -resname EJB-JAR-display-name/Entity-Bean-display-name-c path-of-the-Entity-Bean-attribute-file
 

Example of execution
cjsetappprop MyServer -name adder -type ejb -resname account/MyAccoub -c C:\home\adder_ejb.xml
 

(3) Attribute settings to be edited

The following table describes the property settings for mapping the fields of CMP1.x Entity Bean to a table in the database (<cmp-map>):

Items Mandatory Corresponding tags
Display name of the resource adapter#1 Y <datasource-name>
Catalog name of the database O <catalog-name>
Schema name of the database O <schema-name>
Table name of the database Y <table-name>
Permission or prohibition of writing to the database Y <read-only-access>
Transaction isolation level#2 O <transaction-isolation>
Method of comparing the data by writing to the database O <concurrency-protection>
Information of mapping between the field and the table column#3 Y <field-impl>
Search conditions of the finder method#4 Y <finder-impl>

Legend:
Y: Mandatory
O: Optional

#1
In the case of using a cluster connection pool, specify the display name of the root resource adapter. You cannot specify the member resource adapter.

#2
The value of the transaction isolation level (<transaction-isolation>) that can be used differs based on the options supported in the database and the JDBC driver.

#3
Set a column of the database table for the primary key. This column is also used for mapping the fields of the same database table.
The value of the field name of the EntityBean (<field-name>) cannot be changed. Set a database column (<column-name>) for mapping the field name of the Entity Bean (<field-name>).
The information about the mapping between the fields and the table column (<field-impl>) consists of the following:
Items Corresponding tags
Field name of the EntityBean <field-name>
Column name of the table <column-name>

#4
The value of the method name (<method-name>) of the finder method cannot be changed. Set the search condition (<where-clause>) for the method name table (<method-name>) in the finder method.
The finder method information in the Enterprise Bean (<finder-impl>) consists of the following:
Items Corresponding tags
Method name of the finder method <method-name>
Search condition for the table <where-clause>

For details on the property settings, see 3.5.1 Contents of the Entity Bean property file in the uCosminexus Application Server Application and Resource Definition Reference Guide.

(4) Notes