[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

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14062 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Diego Plentz 2007-10-05 12:55:35 +00:00
parent 52574a20fb
commit ec267130cd
1 changed files with 4 additions and 7 deletions

View File

@ -632,10 +632,7 @@ public final class HbmBinder {
// PERSISTER // PERSISTER
Attribute persisterNode = node.attribute( "persister" ); Attribute persisterNode = node.attribute( "persister" );
if ( persisterNode == null ) { if ( persisterNode != null ) {
// persister = SingleTableEntityPersister.class;
}
else {
try { try {
entity.setEntityPersisterClass( ReflectHelper.classForName( persisterNode entity.setEntityPersisterClass( ReflectHelper.classForName( persisterNode
.getValue() ) ); .getValue() ) );
@ -2249,7 +2246,7 @@ public final class HbmBinder {
String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName(); String entityName = ( (OneToMany) list.getElement() ).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName ); PersistentClass referenced = mappings.getClass( entityName );
IndexBackref ib = new IndexBackref(); IndexBackref ib = new IndexBackref();
ib.setName( '_' + node.attributeValue( "name" ) + "IndexBackref" ); ib.setName( '_' + list.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" );
ib.setUpdateable( false ); ib.setUpdateable( false );
ib.setSelectable( false ); ib.setSelectable( false );
ib.setCollectionRole( list.getRole() ); ib.setCollectionRole( list.getRole() );
@ -2352,7 +2349,7 @@ public final class HbmBinder {
String entityName = ( (OneToMany) map.getElement() ).getReferencedEntityName(); String entityName = ( (OneToMany) map.getElement() ).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName ); PersistentClass referenced = mappings.getClass( entityName );
IndexBackref ib = new IndexBackref(); IndexBackref ib = new IndexBackref();
ib.setName( '_' + node.attributeValue( "name" ) + "IndexBackref" ); ib.setName( '_' + map.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "IndexBackref" );
ib.setUpdateable( false ); ib.setUpdateable( false );
ib.setSelectable( false ); ib.setSelectable( false );
ib.setCollectionRole( map.getRole() ); ib.setCollectionRole( map.getRole() );
@ -2485,7 +2482,7 @@ public final class HbmBinder {
String entityName = ( (OneToMany) collection.getElement() ).getReferencedEntityName(); String entityName = ( (OneToMany) collection.getElement() ).getReferencedEntityName();
PersistentClass referenced = mappings.getClass( entityName ); PersistentClass referenced = mappings.getClass( entityName );
Backref prop = new Backref(); Backref prop = new Backref();
prop.setName( '_' + node.attributeValue( "name" ) + "Backref" ); prop.setName( '_' + collection.getOwnerEntityName() + "." + node.attributeValue( "name" ) + "Backref" );
prop.setUpdateable( false ); prop.setUpdateable( false );
prop.setSelectable( false ); prop.setSelectable( false );
prop.setCollectionRole( collection.getRole() ); prop.setCollectionRole( collection.getRole() );