fixed issue with xml syntax
git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@16753 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
parent
f7eedd7577
commit
b295044275
|
@ -132,9 +132,9 @@
|
|||
</para>
|
||||
|
||||
<para>
|
||||
The properties of a component can be of any Hibernate type (collections, many-to-one
|
||||
associations, other components, etc). Nested components should <emphasis>not</emphasis>
|
||||
be considered an exotic usage. Hibernate is intended to support a fine-grained
|
||||
The properties of a component can be of any Hibernate type (collections, many-to-one
|
||||
associations, other components, etc). Nested components should <emphasis>not</emphasis>
|
||||
be considered an exotic usage. Hibernate is intended to support a fine-grained
|
||||
object model.
|
||||
</para>
|
||||
|
||||
|
@ -179,28 +179,28 @@
|
|||
</set>]]></programlisting>
|
||||
|
||||
<important>
|
||||
<para>
|
||||
If you define a <literal>Set</literal> of composite elements, it is
|
||||
important to implement <literal>equals()</literal> and
|
||||
<para>
|
||||
If you define a <literal>Set</literal> of composite elements, it is
|
||||
important to implement <literal>equals()</literal> and
|
||||
<literal>hashCode()</literal> correctly.
|
||||
</important>
|
||||
</para>
|
||||
</para>
|
||||
</important>
|
||||
|
||||
<para>
|
||||
Composite elements can contain components but not collections. If your
|
||||
composite element contains
|
||||
components, use the <literal><nested-composite-element></literal>
|
||||
tag. This case is a collection of components which
|
||||
themselves have components. You may want to consider if
|
||||
a one-to-many association is more appropriate. Remodel the
|
||||
composite element as an entity, but be aware that even though the Java model
|
||||
is the same, the relational model and persistence semantics are still
|
||||
composite element contains
|
||||
components, use the <literal><nested-composite-element></literal>
|
||||
tag. This case is a collection of components which
|
||||
themselves have components. You may want to consider if
|
||||
a one-to-many association is more appropriate. Remodel the
|
||||
composite element as an entity, but be aware that even though the Java model
|
||||
is the same, the relational model and persistence semantics are still
|
||||
slightly different.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
A composite element mapping does not support null-able properties
|
||||
if you are using a <literal><set></literal>. There is no separate primary key column
|
||||
if you are using a <literal><set></literal>. There is no separate primary key column
|
||||
in the composite element table. Hibernate
|
||||
uses each column's value to identify a record when deleting objects,
|
||||
which is not possible with null values. You have to either use only
|
||||
|
@ -214,7 +214,7 @@
|
|||
<literal><many-to-one></literal> element. This mapping allows
|
||||
you to map extra columns of a many-to-many association table to the
|
||||
composite element class. The following is a many-to-many association
|
||||
from <literal>Order</literal> to <literal>Item</literal>, where
|
||||
from <literal>Order</literal> to <literal>Item</literal>, where
|
||||
<literal>purchaseDate</literal>, <literal>price</literal> and
|
||||
<literal>quantity</literal> are properties of the association:
|
||||
</para>
|
||||
|
@ -288,12 +288,12 @@
|
|||
<listitem>
|
||||
<para>
|
||||
It must re-implement <literal>equals()</literal> and
|
||||
<literal>hashCode()</literal> consistently with the database's
|
||||
<literal>hashCode()</literal> consistently with the database's
|
||||
notion of composite key equality.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
|
||||
|
||||
<note>
|
||||
<title>Note</title>
|
||||
<para>
|
||||
|
@ -301,42 +301,42 @@
|
|||
requirement of Hibernate, it is recommended.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
|
||||
<para>
|
||||
You cannot use an <literal>IdentifierGenerator</literal> to generate composite keys.
|
||||
Instead the application must assign its own identifiers.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
Use the <literal><composite-id></literal> tag, with nested
|
||||
<literal><key-property></literal> elements, in place of the usual
|
||||
Use the <literal><composite-id></literal> tag, with nested
|
||||
<literal><key-property></literal> elements, in place of the usual
|
||||
<literal><id></literal> declaration. For example, the
|
||||
<literal>OrderLine</literal> class has a primary key that depends upon
|
||||
the (composite) primary key of <literal>Order</literal>.
|
||||
</para>
|
||||
|
||||
<programlisting><![CDATA[<class name="OrderLine">
|
||||
|
||||
|
||||
<composite-id name="id" class="OrderLineId">
|
||||
<key-property name="lineId"/>
|
||||
<key-property name="orderId"/>
|
||||
<key-property name="customerId"/>
|
||||
</composite-id>
|
||||
|
||||
|
||||
<property name="name"/>
|
||||
|
||||
|
||||
<many-to-one name="order" class="Order"
|
||||
insert="false" update="false">
|
||||
<column name="orderId"/>
|
||||
<column name="customerId"/>
|
||||
</many-to-one>
|
||||
....
|
||||
|
||||
|
||||
</class>]]></programlisting>
|
||||
|
||||
<para>
|
||||
Any foreign keys referencing the <literal>OrderLine</literal> table are now
|
||||
composite. Declare this in your mappings for other classes. An association
|
||||
Any foreign keys referencing the <literal>OrderLine</literal> table are now
|
||||
composite. Declare this in your mappings for other classes. An association
|
||||
to <literal>OrderLine</literal> is mapped like this:
|
||||
</para>
|
||||
|
||||
|
@ -347,21 +347,21 @@
|
|||
<column name="customerId"/>
|
||||
</many-to-one>]]></programlisting>
|
||||
|
||||
<note>
|
||||
</title>
|
||||
Note
|
||||
</title>
|
||||
<para>
|
||||
The <literal><column></literal> tag is an alternative to the
|
||||
<literal>column</literal> attribute everywhere.
|
||||
</para>
|
||||
</note>
|
||||
|
||||
<para>
|
||||
<tip>
|
||||
<para>
|
||||
The <literal>column</literal> element is an alternative to the
|
||||
<literal>column</literal> attribute everywhere. Using the
|
||||
<literal>column</literal> element just gives more declaration
|
||||
options, which are mostly useful when utilizing
|
||||
<literal>hbm2ddl</literal>
|
||||
</para>
|
||||
</tip>
|
||||
|
||||
<para>
|
||||
A <literal>many-to-many</literal> association to <literal>OrderLine</literal> also
|
||||
uses the composite foreign key:
|
||||
</para>
|
||||
|
||||
|
||||
<programlisting><![CDATA[<set name="undeliveredOrderLines">
|
||||
<key column name="warehouseId"/>
|
||||
<many-to-many class="OrderLine">
|
||||
|
@ -372,7 +372,7 @@
|
|||
</set>]]></programlisting>
|
||||
|
||||
<para>
|
||||
The collection of <literal>OrderLine</literal>s in <literal>Order</literal> would
|
||||
The collection of <literal>OrderLine</literal>s in <literal>Order</literal> would
|
||||
use:
|
||||
</para>
|
||||
|
||||
|
@ -387,9 +387,9 @@
|
|||
<para>
|
||||
The <literal><one-to-many></literal> element declares no columns.
|
||||
</para>
|
||||
|
||||
|
||||
<para>
|
||||
If <literal>OrderLine</literal> itself owns a collection, it also has a composite
|
||||
If <literal>OrderLine</literal> itself owns a collection, it also has a composite
|
||||
foreign key.
|
||||
</para>
|
||||
|
||||
|
@ -426,9 +426,9 @@
|
|||
|
||||
<para>
|
||||
The semantics of a <literal><dynamic-component></literal> mapping are identical
|
||||
to <literal><component></literal>. The advantage of this kind of mapping is
|
||||
to <literal><component></literal>. The advantage of this kind of mapping is
|
||||
the ability to determine the actual properties of the bean at deployment time just
|
||||
by editing the mapping document. Runtime manipulation of the mapping document is
|
||||
by editing the mapping document. Runtime manipulation of the mapping document is
|
||||
also possible, using a DOM parser. You can also access, and change, Hibernate's
|
||||
configuration-time metamodel via the <literal>Configuration</literal> object.
|
||||
</para>
|
||||
|
|
Loading…
Reference in New Issue