[hibernate-commits] Hibernate SVN: r11193 - in branches/Branch_3_2/HibernateExt/annotations/src: java/org/hibernate/cfg and 3 other directories.

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Sat Feb 10 12:35:56 EST 2007


Author: epbernard
Date: 2007-02-10 12:35:56 -0500 (Sat, 10 Feb 2007)
New Revision: 11193

Modified:
   branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/annotations/Table.java
   branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/AnnotationBinder.java
   branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java
   branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/join/Cat.java
   branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/xml/hbm/HbmTest.java
Log:
ANN-537 Support comments on table

Modified: branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/annotations/Table.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/annotations/Table.java	2007-02-10 17:05:28 UTC (rev 11192)
+++ branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/annotations/Table.java	2007-02-10 17:35:56 UTC (rev 11193)
@@ -24,4 +24,9 @@
 	 */
 	Index[] indexes() default {};
 
+	/**
+	 * define a table comment
+	 */
+	String comment() default "";
+
 }

Modified: branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/AnnotationBinder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/AnnotationBinder.java	2007-02-10 17:05:28 UTC (rev 11192)
+++ branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/AnnotationBinder.java	2007-02-10 17:35:56 UTC (rev 11193)
@@ -760,9 +760,9 @@
 		mappings.addClass( persistentClass );
 		entityBinder.finalSecondaryTableBinding( propertyHolder );
 
-		//add indexes
-		entityBinder.addIndexes( annotatedClass.getAnnotation( org.hibernate.annotations.Table.class ) );
-		entityBinder.addIndexes( annotatedClass.getAnnotation( org.hibernate.annotations.Tables.class ) );
+		//add process complementary Table definition (index & all)
+		entityBinder.processComplementaryTableDefinitions( annotatedClass.getAnnotation( org.hibernate.annotations.Table.class ) );
+		entityBinder.processComplementaryTableDefinitions( annotatedClass.getAnnotation( org.hibernate.annotations.Tables.class ) );
 
 	}
 

Modified: branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java	2007-02-10 17:05:28 UTC (rev 11192)
+++ branches/Branch_3_2/HibernateExt/annotations/src/java/org/hibernate/cfg/annotations/EntityBinder.java	2007-02-10 17:35:56 UTC (rev 11193)
@@ -664,7 +664,7 @@
 		this.ignoreIdAnnotations = ignoreIdAnnotations;
 	}
 
-	public void addIndexes(org.hibernate.annotations.Table table) {
+	public void processComplementaryTableDefinitions(org.hibernate.annotations.Table table) {
 		if ( table == null ) return;
 		String tableName = table.appliesTo();
 		Iterator tables = persistentClass.getTableClosureIterator();
@@ -681,13 +681,14 @@
 					"@org.hibernate.annotations.Table references an unknown table: " + tableName
 			);
 		}
+		if ( ! BinderHelper.isDefault( table.comment() ) ) hibTable.setComment( table.comment() );
 		TableBinder.addIndexes( hibTable, table.indexes(), mappings );
 	}
 
-	public void addIndexes(Tables tables) {
+	public void processComplementaryTableDefinitions(Tables tables) {
 		if ( tables == null ) return;
 		for ( org.hibernate.annotations.Table table : tables.values() ) {
-			addIndexes( table );
+			processComplementaryTableDefinitions( table );
 		}
 	}
 

Modified: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/join/Cat.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/join/Cat.java	2007-02-10 17:05:28 UTC (rev 11192)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/join/Cat.java	2007-02-10 17:35:56 UTC (rev 11193)
@@ -21,7 +21,7 @@
 @SecondaryTable(name = "`Cat nbr1`"),
 @SecondaryTable(name = "Cat2", uniqueConstraints = {@UniqueConstraint(columnNames = {"storyPart2"})})
 		})
- at Table(appliesTo = "Cat", indexes = @Index(name = "secondname", columnNames = "secondName"))
+ at Table(appliesTo = "Cat", indexes = @Index(name = "secondname", columnNames = "secondName"), comment = "My cat table")
 public class Cat implements Serializable {
 
 	private Integer id;

Modified: branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/xml/hbm/HbmTest.java
===================================================================
--- branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/xml/hbm/HbmTest.java	2007-02-10 17:05:28 UTC (rev 11192)
+++ branches/Branch_3_2/HibernateExt/annotations/src/test/org/hibernate/test/annotations/xml/hbm/HbmTest.java	2007-02-10 17:35:56 UTC (rev 11193)
@@ -87,8 +87,6 @@
 		return new Class[]{
 				PrimeMinister.class,
 				Sky.class,
-				//AImpl.class,
-				//BImpl.class,
 				ZImpl.class
 
 		};




More information about the hibernate-commits mailing list