[hibernate-commits] Hibernate SVN: r20742 - core/trunk/documentation/manual/src/main/docbook/en-US/content.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Tue Sep 28 12:39:06 EDT 2010


Author: hardy.ferentschik
Date: 2010-09-28 12:39:06 -0400 (Tue, 28 Sep 2010)
New Revision: 20742

Modified:
   core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml
Log:
HHH-5205 Updated documentation about @Source

Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml
===================================================================
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml	2010-09-28 16:32:26 UTC (rev 20741)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/basic_mapping.xml	2010-09-28 16:39:06 UTC (rev 20742)
@@ -2203,8 +2203,8 @@
         <title>Timestamp</title>
 
         <para>Alternatively, you can use a timestamp. Timestamps are a less
-        safe implementation of optimistic locking. However, sometimes the
-        application might use the timestamps in other ways.</para>
+        safe implementation of optimistic locking. However, sometimes an
+        application might use the timestamps in other ways as well.</para>
 
         <para>Simply mark a property of type <classname>Date</classname> or
         <classname>Calendar</classname> as
@@ -2217,8 +2217,19 @@
     public Date getLastUpdate() { ... }
 }           </programlisting>
 
-        <para>Like version numbers, the timestamp can be generated by the
-        database instead of Hibernate. To do that, use
+        <para>When using timestamp versioning you can tell Hibernate where to
+        retrieve the timestamp value from - database or JVM - by optionally
+        adding the <classname>@org.hibernate.annotations.Source</classname>
+        annotation to the property. Possible values for the value attribute of
+        the annotation are
+        <classname>org.hibernate.annotations.SourceType.VM</classname> and
+        <classname>org.hibernate.annotations.SourceType.DB</classname>. The
+        default is <classname>SourceType.DB</classname> which is also used in
+        case there is no <classname>@Source</classname> annotation at all.
+        </para>
+
+        <para>Like in the case of version numbers, the timestamp can also be
+        generated by the database instead of Hibernate. To do that, use
         <code>@org.hibernate.annotations.Generated(GenerationTime.ALWAYS).</code></para>
 
         <para>In hbm.xml, use the <literal>&lt;timestamp&gt;</literal>



More information about the hibernate-commits mailing list