[hibernate-commits] Hibernate SVN: r10329 - in trunk/HibernateExt/metadata/src: java/org/hibernate/cfg java/org/hibernate/cfg/annotations test/org/hibernate/test/annotations/indexcoll

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Aug 24 00:21:30 EDT 2006


Author: epbernard
Date: 2006-08-24 00:21:26 -0400 (Thu, 24 Aug 2006)
New Revision: 10329

Modified:
   trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
   trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
   trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java
Log:
ANN-379 map key should not be marked as unique

Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java	2006-08-24 03:41:24 UTC (rev 10328)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationConfiguration.java	2006-08-24 04:21:26 UTC (rev 10329)
@@ -403,6 +403,7 @@
 						StringBuilder sb = new StringBuilder(
 								"Foreign key circularity dependency involving the following tables: "
 						);
+						//TODO deduplicate tables
 						sb.append( table );
 						if ( beAfter > -1 ) sb.append( ", " ).append( dependentTable );
 						if ( beBefore < orderedFkSecondPasses.size() ) {

Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java
===================================================================
--- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java	2006-08-24 03:41:24 UTC (rev 10328)
+++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java	2006-08-24 04:21:26 UTC (rev 10329)
@@ -195,7 +195,6 @@
 					SimpleValueBinder elementBinder = new SimpleValueBinder();
 					elementBinder.setMappings( mappings );
 					elementBinder.setReturnedClassName( mapKeyType );
-					//FIXME get the columns from an annotation
 
 					Ejb3Column[] elementColumns = mapKeyColumns;
 					if ( elementColumns == null || elementColumns.length == 0 ) {
@@ -222,7 +221,13 @@
 			}
 			//FIXME pass the Index Entity JoinColumns
 			if ( isIndexOfEntities ) {
-				bindManytoManyInverseFk( collectionEntity, mapKeyManyToManyColumns, element, true, mappings );
+				bindManytoManyInverseFk(
+						collectionEntity,
+						mapKeyManyToManyColumns,
+						element,
+						false, //a map key column has no unique constraint
+						mappings
+				);
 			}
 		}
 	}

Modified: trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java
===================================================================
--- trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java	2006-08-24 03:41:24 UTC (rev 10328)
+++ trunk/HibernateExt/metadata/src/test/org/hibernate/test/annotations/indexcoll/IndexedCollectionTest.java	2006-08-24 04:21:26 UTC (rev 10329)
@@ -371,14 +371,18 @@
 		Session s = openSession();
 		Transaction tx = s.beginTransaction();
 		Atmosphere atm = new Atmosphere();
+		Atmosphere atm2 = new Atmosphere();
 		GasKey key = new GasKey();
 		key.setName( "O2" );
 		Gas o2 = new Gas();
 		o2.name = "oxygen";
 		atm.gases.put( "100%", o2 );
 		atm.gasesPerKey.put(key, o2);
+		atm2.gases.put( "100%", o2 );
+		atm2.gasesPerKey.put(key, o2);
 		s.persist( key );
 		s.persist( atm );
+		s.persist( atm2 );
 		s.flush();
 		s.clear();
 




More information about the hibernate-commits mailing list