[hibernate-commits] Hibernate SVN: r12755 - in trunk/HibernateExt/annotations: src/java/org/hibernate/cfg/annotations and 1 other directory.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Wed Jul 11 19:03:33 EDT 2007


Author: epbernard
Date: 2007-07-11 19:03:33 -0400 (Wed, 11 Jul 2007)
New Revision: 12755

Modified:
   trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml
   trunk/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java
Log:
ANN-606 Warn when @Immutable is used on a sub entity

Modified: trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml
===================================================================
--- trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml	2007-07-11 22:20:24 UTC (rev 12754)
+++ trunk/HibernateExt/annotations/doc/reference/en/modules/entity.xml	2007-07-11 23:03:33 UTC (rev 12755)
@@ -2244,7 +2244,7 @@
     <classname>org.hibernate.annotations</classname> package contains all
     these annotations extensions.</para>
 
-    <sect2 id="entity-hibspec-entity" revision="3">
+    <sect2 id="entity-hibspec-entity" revision="4">
       <title>Entity</title>
 
       <para>You can fine tune some of the actions done by Hibernate on
@@ -2362,7 +2362,8 @@
 
       <para><literal>@Immutable</literal> marks an entity as immutable. The
       entity may not be updated or deleted by the application. This allows
-      Hibernate to make some minor performance optimizations.</para>
+      Hibernate to make some minor performance optimizations.
+      <literal>@Immutable</literal> must be use on root entities only.</para>
 
       <para><literal>@Persister</literal> lets you define your own custom
       persistence strategy. You may, for example, specify your own subclass of

Modified: trunk/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java
===================================================================
--- trunk/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java	2007-07-11 22:20:24 UTC (rev 12754)
+++ trunk/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java	2007-07-11 23:03:33 UTC (rev 12755)
@@ -196,6 +196,10 @@
 				log.warn( "@org.hibernate.annotations.Entity used on a non root entity: ignored for "
 						+ annotatedClass.getName() );
 			}
+			if ( annotatedClass.isAnnotationPresent( Immutable.class ) ) {
+				log.warn( "@Immutable used on a non root entity: ignored for "
+						+ annotatedClass.getName() );
+			}
 		}
 		persistentClass.setOptimisticLockMode( getVersioning( optimisticLockType ) );
 		persistentClass.setSelectBeforeUpdate( selectBeforeUpdate );




More information about the hibernate-commits mailing list