[hibernate-commits] Hibernate SVN: r10905 - trunk/Hibernate3/src/org/hibernate/mapping

hibernate-commits at lists.jboss.org hibernate-commits at lists.jboss.org
Thu Nov 30 19:34:55 EST 2006


Author: epbernard
Date: 2006-11-30 19:34:55 -0500 (Thu, 30 Nov 2006)
New Revision: 10905

Modified:
   trunk/Hibernate3/src/org/hibernate/mapping/PersistentClass.java
Log:
ANN-425 Property not found when defined in a @IdClass and referenced by a @OneToMany
ANN-499 @IdClass and @ManyToOne leads to repeated column exception

Modified: trunk/Hibernate3/src/org/hibernate/mapping/PersistentClass.java
===================================================================
--- trunk/Hibernate3/src/org/hibernate/mapping/PersistentClass.java	2006-12-01 00:34:34 UTC (rev 10904)
+++ trunk/Hibernate3/src/org/hibernate/mapping/PersistentClass.java	2006-12-01 00:34:55 UTC (rev 10905)
@@ -330,6 +330,12 @@
 
 	public Property getRecursiveProperty(String propertyPath) throws MappingException {
 		Iterator iter = getPropertyIterator(); //  getReferenceablePropertyIterator();
+		if ( getIdentifierMapper() != null ) {
+			ArrayList iterators = new ArrayList(2);
+			iterators.add(iter);
+			iterators.add( getIdentifierMapper().getPropertyIterator() );
+			iter = new JoinedIterator( iterators );
+		}
 		try {
 			return getRecursiveProperty( propertyPath, iter );
 		}
@@ -640,7 +646,11 @@
 	
 	protected void checkColumnDuplication() {
 		HashSet cols = new HashSet();
-		checkColumnDuplication( cols, getKey().getColumnIterator() );
+		if (getIdentifierMapper() == null ) {
+			//an identifier mapper => getKey will be included in the getNonDuplicatedPropertyIterator()
+			//and checked later, so it needs to be excluded
+			checkColumnDuplication( cols, getKey().getColumnIterator() );
+		}
 		checkColumnDuplication( cols, getDiscriminatorColumnIterator() );
 		checkPropertyColumnDuplication( cols, getNonDuplicatedPropertyIterator() );
 		Iterator iter = getJoinIterator();




More information about the hibernate-commits mailing list