Author: d.plentz
Date: 2007-10-05 08:49:52 -0400 (Fri, 05 Oct 2007)
New Revision: 14061
Modified:
core/branches/Branch_3_2/src/org/hibernate/cfg/HbmBinder.java
Log:
[HHH-2598] Mapping a collection of entities from two different classes with the same
collection name results in duplicate backref property exception if collection keys are not
null
Modified: core/branches/Branch_3_2/src/org/hibernate/cfg/HbmBinder.java
===================================================================
--- core/branches/Branch_3_2/src/org/hibernate/cfg/HbmBinder.java 2007-10-04 18:52:48 UTC
(rev 14060)
+++ core/branches/Branch_3_2/src/org/hibernate/cfg/HbmBinder.java 2007-10-05 12:49:52 UTC
(rev 14061)
@@ -633,10 +633,7 @@
// PERSISTER
Attribute persisterNode = node.attribute( "persister" );
- if ( persisterNode == null ) {
- // persister = SingleTableEntityPersister.class;
- }
- else {
+ if ( persisterNode != null ) {
try {
entity.setEntityPersisterClass( ReflectHelper.classForName( persisterNode
.getValue() ) );
@@ -2250,7 +2247,7 @@
String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName );
IndexBackref ib = new IndexBackref();
- ib.setName( '_' + node.attributeValue( "name" ) +
"IndexBackref" );
+ ib.setName( '_' + list.getOwnerEntityName() + "." +
node.attributeValue( "name" ) + "IndexBackref" );
ib.setUpdateable( false );
ib.setSelectable( false );
ib.setCollectionRole( list.getRole() );
@@ -2353,7 +2350,7 @@
String entityName = ( (OneToMany) map.getElement() ).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName );
IndexBackref ib = new IndexBackref();
- ib.setName( '_' + node.attributeValue( "name" ) +
"IndexBackref" );
+ ib.setName( '_' + map.getOwnerEntityName() + "." +
node.attributeValue( "name" ) + "IndexBackref" );
ib.setUpdateable( false );
ib.setSelectable( false );
ib.setCollectionRole( map.getRole() );
@@ -2486,7 +2483,7 @@
String entityName = ( (OneToMany) collection.getElement()
).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName );
Backref prop = new Backref();
- prop.setName( '_' + node.attributeValue( "name" ) +
"Backref" );
+ prop.setName( '_' + collection.getOwnerEntityName() + "." +
node.attributeValue( "name" ) + "Backref" );
prop.setUpdateable( false );
prop.setSelectable( false );
prop.setCollectionRole( collection.getRole() );
Show replies by date