Java Reference
In-Depth Information
</weblogic-rdbms-bean>
</weblogic-rdbms-jar>
Recall that the deployment-descriptor files are supposedly read by the EJB container, not by people. I
list them here just for the demonstration of some key concepts. Don't try to write or read these files
using a text editor. Use the deployment tools instead.
As you see from the Listing 22-4 , you specify the abstract schema name ( YachtBean ), the primary key
field ( yachtName ), and all other persistent fields ( builder , engineType , capacity and
maxVelocity ) in the deployment descriptor, as follows:
<persistence-type>Container</persistence-type>
<abstract-schema-name>YachtBean</abstract-schema-name>
<primkey-field>yachtName</primkey-field>
<cmp-field><field-name>builder</field-name></cmp-field>
<cmp-field><field-name>engineType</field-name></cmp-field>
<cmp-field><field-name>capacity</field-name></cmp-field>
<cmp-field><field-name>maxVelocity</field-name></cmp-field>
You further declare the persistent type as CMP, as shown here:
<persistence-type>Container</persistence-type>
<persistence-type>
<type-identifier>WebLogic_CMP_RDBMS</type-identifier>
… …
</persistence-type>
You then define the mapping between YachtEJB and the underlying persistent store ( yachtClub-
datasource ) by specifying the mapping between each persistent field and its corresponding table-
column name (such as yachtName mapped to yacht_name , maxVelocity mapped to
max_velocity , and so on), as follows:
<ejb-name>YachtEJB</ejb-name>
<data-source-name>yachtClub-datasource</data-source-name>
<table-name>yacht</table-name>
<field-map>
<cmp-field>yachtName</cmp-field>
<dbms-column>yacht_name</dbms-column>
</field-map>
<field-map>
<cmp-field>builder</cmp-field>
<dbms-column>builder</dbms-column>
</field-map>
… …
Such information tells the EJB container to implement the access calls for these persistent fields. Based
on the deployment information, the EJB container determines the approperate JDBC implementations
(that is, the SQL calls) for the persistent fields and keeps a CMP bean's persistent field synchronized
with the state of the database record it represents. After the concrete classes are generated during the
Search WWH ::




Custom Search