minor changes to components

git-svn-id: https://svn.jboss.org/repos/hibernate/trunk/Hibernate3/doc@4414 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Gavin King 2004-08-22 11:03:08 +00:00
parent 0ec2e527fc
commit a562acbbde
1 changed files with 12 additions and 15 deletions

View File

@ -264,25 +264,21 @@
<para> <para>
Since a composite identifier must be assigned to the object before saving it, Since a composite identifier must be assigned to the object before saving it,
we can't use <literal>unsaved-value</literal> of the identifier to distinguish we can't use <literal>unsaved-value</literal> of the identifier to distinguish
between newly instantiated instances and instances saved in a previous session. between newly instantiated transient instances and detached instances from a
previous session.
</para> </para>
<para> <para>
You may instead implement <literal>Interceptor.isUnsaved()</literal> if So, if you wish to use transitive reattachment (you don't have to), you must
you wish to use <literal>saveOrUpdate()</literal> or cascading save / update. either implement <literal>Interceptor.isUnsaved()</literal> or define the
As an alternative, you may also set the <literal>unsaved-value</literal> <literal>unsaved-value</literal> of a <literal>&lt;version&gt;</literal> or
attribute on a <literal>&lt;version&gt;</literal> (or <literal>&lt;timestamp&gt;</literal> element.
<literal>&lt;timestamp&gt;</literal>) element to specify a
value that indicates a new transient instance. In this case, the version
of the entity is used instead of the (assigned) identifier and you don't have
to implement <literal>Interceptor.isUnsaved()</literal> yourself.
</para> </para>
<para> <para>
Use the <literal>&lt;composite-id&gt;</literal> tag (same attributes and Use the <literal>&lt;composite-id&gt;</literal> tag (with nested
elements as <literal>&lt;component&gt;</literal>) in place of <literal>&lt;key-property&gt;</literal> elements) in place of the
<literal>&lt;id&gt;</literal> for the declaration of a composite identifier usual <literal>&lt;id&gt;</literal> declaration:
class:
</para> </para>
<programlisting><![CDATA[<class name="eg.Foo" table"FOOS"> <programlisting><![CDATA[<class name="eg.Foo" table"FOOS">
@ -364,8 +360,9 @@
The semantics of a <literal>&lt;dynamic-component&gt;</literal> mapping are identical The semantics of a <literal>&lt;dynamic-component&gt;</literal> mapping are identical
to <literal>&lt;component&gt;</literal>. The advantage of this kind of mapping is to <literal>&lt;component&gt;</literal>. The advantage of this kind of mapping is
the ability to determine the actual properties of the bean at deployment time, just 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.) also possible, using a DOM parser. Even better, you can access (and change) Hibernate's
configuration-time metamodel via the <literal>Configuration</literal> object.
</para> </para>
</sect1> </sect1>