C M P 2 . 0
the other hand, foreign key fields must always be nullable.
5
A detailed description of the
elements contained in the key field element follows:
Table 9 4, key field Tags
Tag Name
Description
Required
field name
This identifies the field to which this mapping applies. This
Yes
name must match a primary key field of the current entity.
column name
Specifies the column name in which this primary key field
No, default
will be stored. If this is relationship uses
depends on
foreign key mapping, this column will be added to the table
mapping type
for the related entity. If this relationship uses
relation table mapping, this column is added to the
relation table. This element is not allowed for mapped
dependent value class; instead use the property element
described in Chapter 3 of the JBossCMP Documentation.
jdbc type
This is the JDBC type that is used when setting parameters
Only required if
in a JDBC PreparedStatement or loading data from a JDBC
sql type is
ResultSet. The valid types are defined in java.sql.Types.
specified, default
is based on
datasource
mapping
sql type
This is the SQL type that is used in create table statements
Only required if
for this field. Valid sql types are only limited by your
jdbc type is
database vendor.
specified, default
is based on
datasource
mapping
F o r e i g n K e y M a p p i n g
Foreign key mapping is the most common mapping style for one to one and one to many
relationships, but is not allowed for many to many relationships. The foreign key mapping
element is simply declared by adding an empty foreign key mapping element to the ejb
relation element.
5
The current implementation of JBossCMP inserts a row into the database for a new entity between ejbCreate and ejbPostCreate. Since the
EJB specification does not allow a relationship to be modified until ejbPostCreate, a foreign key will be initially set to null. There is a similar
problem with removal. This limitation will be removed in a future release.
92
footer
Our partners:
PHP: Hypertext Preprocessor Cheap Web Hosting
JSP Web Hosting
Ontario Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Java Hosting
Cheapest Hosting
Visionwebhosting.net Business web hosting division of Vision Web Hosting Inc.. All rights reserved