user manual

Chapter 15: Entity Beans and Table Mapping for CMP 2.0 157
Container-Managed Persistence in Borland Enterprise Server
<entity>
<ejb-name>CustomerEJB</ejb-name>
<property>
<prop-name>ejb.datasource</property>
<prop-value>serial://ds/myDatasource</prop-value>
</property>
</entity>
The Borland CMP engine will automatically create tables in this datasource
based on the bean's name and fields.
CASE 2: A deployment environment with (or without) existing database tables
using supported databases.
In this case, you need to supply information on the tables to which the entities
map. You'll provide a table name in the <entity> portion of the descriptor, and
some properties in the <table-properties> portion:
<entity>
<ejb-name>CustomerEJB</ejb-name>
<cmp2-info>
<table-name>CUSTOMER</table-name>
</cmp2-info>
</entity>
.
.
<table-properties>
<table-name>CUSTOMER</table-name>
<property>
<prop-name>datasource</prop-name>
<prop-value>serial://ds/myDatasource</prop-value>
</property>
</table-properties>
Note that the datasource property is called datasource when specified in the
<table-properties> element and ejb.datasource when in the <entity> element. If
you are using a database other than JDataStore or Cloudscape and would like
to have the Borland CMP engine automatically create this table, add the
following XML to the <table-properties> element:
.
.
<table-properties>
<table-name>CUSTOMER</table-name>
<property>
<prop-name>create-tables</prop-name>
<prop-value>True</prop-value>
</property>
</table-properties>