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
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 |
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#1 |
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#2 |
Y |
<field-impl> |
Search conditions of the finder method#3 |
Y |
<finder-impl> |
- #1
-
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.
- #2
-
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>
- #3
-
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 Specifications of the HITACHI Entity Bean Property file in the uCosminexus Application Server Application and Resource Definition Reference Guide.
(4) Notes
-
The function for mapping the CMP field of an Entity Bean to multiple tables in the database is not provided.
-
If the user specified in the DB Connector definition to be used for mapping and the owner of the database table that forms the CMP mapping destination, are different, the user specified in the DB Connector definition needs the following permissions:
For mapping: SELECT
For execution: SELECT, INSERT, UPDATE, DELETE