From: <hib...@li...> - 2006-05-01 23:28:50
|
Author: epbernard Date: 2006-05-01 19:28:45 -0400 (Mon, 01 May 2006) New Revision: 9847 Added: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/OneToOneSecondPass.java Removed: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java Log: Refactor true OneToOne processing Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-05-01 21:40:41 UTC (rev 9846) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/AnnotationBinder.java 2006-05-01 23:28:45 UTC (rev 9847) @@ -71,6 +71,7 @@ import org.hibernate.annotations.Index; import org.hibernate.annotations.LazyToOne; import org.hibernate.annotations.LazyToOneOption; +import org.hibernate.annotations.MapKeyManyToMany; import org.hibernate.annotations.NotFound; import org.hibernate.annotations.NotFoundAction; import org.hibernate.annotations.OnDelete; @@ -85,7 +86,6 @@ import org.hibernate.annotations.TypeDef; import org.hibernate.annotations.TypeDefs; import org.hibernate.annotations.Where; -import org.hibernate.annotations.MapKeyManyToMany; import org.hibernate.cfg.annotations.CollectionBinder; import org.hibernate.cfg.annotations.EntityBinder; import org.hibernate.cfg.annotations.Nullability; @@ -121,7 +121,6 @@ import org.hibernate.reflection.XClass; import org.hibernate.reflection.XPackage; import org.hibernate.reflection.XProperty; -import org.hibernate.type.ForeignKeyDirection; import org.hibernate.type.TypeFactory; import org.hibernate.util.StringHelper; @@ -1766,7 +1765,7 @@ propertyHolder.addProperty( prop, columns ); } - private static void defineFetchingStrategy(ToOne toOne, XProperty property) { + protected static void defineFetchingStrategy(ToOne toOne, XProperty property) { LazyToOne lazy = property.getAnnotation( LazyToOne.class ); Fetch fetch = property.getAnnotation( Fetch.class ); ManyToOne manyToOne = property.getAnnotation( ManyToOne.class ); @@ -1814,7 +1813,7 @@ private static void bindOneToOne( String cascadeStrategy, - Ejb3JoinColumn[] columns, + Ejb3JoinColumn[] joinColumns, boolean optional, FetchMode fetchMode, boolean ignoreNotFound, @@ -1838,7 +1837,7 @@ currentColumn = (org.hibernate.mapping.Column) idColumns.next(); idColumnNames.add( currentColumn.getName() ); } - for ( Ejb3JoinColumn col : columns ) { + for ( Ejb3JoinColumn col : joinColumns ) { if ( ! idColumnNames.contains( col.getMappingColumn().getName() ) ) { mapToPK = false; break; @@ -1848,66 +1847,20 @@ if ( trueOneToOne || mapToPK || ! isDefault( mappedBy ) ) { //is a true one-to-one //FIXME referencedColumnName ignored => ordering may fail. - - org.hibernate.mapping.OneToOne value = new org.hibernate.mapping.OneToOne( - propertyHolder.getTable(), propertyHolder.getPersistentClass() + mappings.addSecondPass( + new OneToOneSecondPass( + mappedBy, + propertyHolder.getEntityName(), + propertyName, + propertyHolder, inferredData, targetEntity, ignoreNotFound, cascadeOnDelete, + optional, cascadeStrategy, joinColumns, mappings + ) ); - value.setPropertyName( propertyName ); - String referencedEntityName; - if ( isDefault( targetEntity, mappings ) ) { - referencedEntityName = inferredData.getClassOrElementName(); - } - else { - referencedEntityName = targetEntity.getName(); - } - value.setReferencedEntityName( referencedEntityName ); - defineFetchingStrategy( value, inferredData.getProperty() ); - //value.setFetchMode( fetchMode ); - value.setCascadeDeleteEnabled( cascadeOnDelete ); - //value.setLazy( fetchMode != FetchMode.JOIN ); - - if ( !optional ) value.setConstrained( true ); - value.setForeignKeyType( - value.isConstrained() ? - ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT : - ForeignKeyDirection.FOREIGN_KEY_TO_PARENT - ); - PropertyBinder binder = new PropertyBinder(); - binder.setName( propertyName ); - binder.setValue( value ); - binder.setCascade( cascadeStrategy ); - binder.setPropertyAccessorName( inferredData.getDefaultAccess() ); - Property prop = binder.make(); - if ( ! isDefault( mappedBy ) ) { - mappings.addSecondPass( - new ToOneMappedBySecondPass( - mappedBy, - value, - propertyHolder.getEntityName(), - propertyName, - prop, propertyHolder, ignoreNotFound, mappings - ) - ); - } - else { - String path = propertyHolder.getPath() + "." + propertyName; - mappings.addSecondPass( - new FkSecondPass( - value, columns, - !optional, //cannot have nullabe and unique on certain DBs - path, mappings - ) - ); - //no column associated since its a one to one - propertyHolder.addProperty( prop ); - } - - } else { //has a FK on the table bindManyToOne( - cascadeStrategy, columns, optional, ignoreNotFound, cascadeOnDelete, + cascadeStrategy, joinColumns, optional, ignoreNotFound, cascadeOnDelete, targetEntity, propertyHolder, inferredData, true, isIdentifierMapper, mappings ); Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java 2006-05-01 21:40:41 UTC (rev 9846) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/BinderHelper.java 2006-05-01 23:28:45 UTC (rev 9847) @@ -78,8 +78,9 @@ //associated entity only used for more precise exception, yuk! if ( columns[0].isImplicit() || StringHelper.isNotEmpty( columns[0].getMappedBy() ) ) return; int fkEnum = Ejb3JoinColumn.checkReferencedColumnsType( columns, ownerEntity, mappings ); - PersistentClass associatedClass = columns[0].getPropertyHolder() == null ? null : columns[0].getPropertyHolder() - .getPersistentClass(); + PersistentClass associatedClass = columns[0].getPropertyHolder() != null ? + columns[0].getPropertyHolder().getPersistentClass() : + null; if ( Ejb3JoinColumn.NON_PK_REFERENCE == fkEnum ) { /** * Create a synthetic property to refer to including an Copied: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/OneToOneSecondPass.java (from rev 9833, trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java) =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java 2006-04-30 04:08:48 UTC (rev 9833) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/OneToOneSecondPass.java 2006-05-01 23:28:45 UTC (rev 9847) @@ -0,0 +1,242 @@ +//$Id$ +package org.hibernate.cfg; + +import java.util.Iterator; +import java.util.Map; + +import org.hibernate.AnnotationException; +import org.hibernate.MappingException; +import org.hibernate.cfg.annotations.PropertyBinder; +import org.hibernate.mapping.Column; +import org.hibernate.mapping.DependantValue; +import org.hibernate.mapping.Join; +import org.hibernate.mapping.ManyToOne; +import org.hibernate.mapping.OneToOne; +import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Property; +import org.hibernate.mapping.SimpleValue; +import org.hibernate.reflection.XClass; +import org.hibernate.type.ForeignKeyDirection; +import org.hibernate.util.StringHelper; + +/** + * We have to handle OneToOne in a second pass because: + * - + */ +public class OneToOneSecondPass implements SecondPass { + private String mappedBy; + private ExtendedMappings mappings; + private String ownerEntity; + private String ownerProperty; + private PropertyHolder propertyHolder; + private boolean ignoreNotFound; + private PropertyData inferredData; + private XClass targetEntity; + private boolean cascadeOnDelete; + private boolean optional; + private String cascadeStrategy; + private Ejb3JoinColumn[] joinColumns; + + //that suck, we should read that from the property mainly + public OneToOneSecondPass( + String mappedBy, String ownerEntity, String ownerProperty, + PropertyHolder propertyHolder, PropertyData inferredData, XClass targetEntity, boolean ignoreNotFound, + boolean cascadeOnDelete, boolean optional, String cascadeStrategy, Ejb3JoinColumn[] columns, + ExtendedMappings mappings + ) { + this.ownerEntity = ownerEntity; + this.ownerProperty = ownerProperty; + this.mappedBy = mappedBy; + this.propertyHolder = propertyHolder; + this.mappings = mappings; + this.ignoreNotFound = ignoreNotFound; + this.inferredData = inferredData; + this.targetEntity = targetEntity; + this.cascadeOnDelete = cascadeOnDelete; + this.optional = optional; + this.cascadeStrategy = cascadeStrategy; + this.joinColumns = columns; + } + + //TODO refactor this code, there is a lot of duplication in this method + public void doSecondPass(Map persistentClasses, Map inheritedMetas) throws MappingException { + org.hibernate.mapping.OneToOne value = new org.hibernate.mapping.OneToOne( + propertyHolder.getTable(), propertyHolder.getPersistentClass() + ); + final String propertyName = inferredData.getPropertyName(); + value.setPropertyName( propertyName ); + String referencedEntityName; + if ( AnnotationBinder.isDefault( targetEntity, mappings ) ) { + referencedEntityName = inferredData.getClassOrElementName(); + } + else { + referencedEntityName = targetEntity.getName(); + } + value.setReferencedEntityName( referencedEntityName ); + AnnotationBinder.defineFetchingStrategy( value, inferredData.getProperty() ); + //value.setFetchMode( fetchMode ); + value.setCascadeDeleteEnabled( cascadeOnDelete ); + //value.setLazy( fetchMode != FetchMode.JOIN ); + + if ( !optional ) value.setConstrained( true ); + value.setForeignKeyType( + value.isConstrained() ? + ForeignKeyDirection.FOREIGN_KEY_FROM_PARENT : + ForeignKeyDirection.FOREIGN_KEY_TO_PARENT + ); + PropertyBinder binder = new PropertyBinder(); + binder.setName( propertyName ); + binder.setValue( value ); + binder.setCascade( cascadeStrategy ); + binder.setPropertyAccessorName( inferredData.getDefaultAccess() ); + Property prop = binder.make(); + if ( AnnotationBinder.isDefault( mappedBy ) ) { + /* + * we need to check if the columns are in the right order + * if not, then we need to create a many to one and formula + * but actually, since entities linked by a one to one need + * to share the same composite id class, this cannot happen in hibernate + */ + boolean rightOrder = true; + + if (rightOrder) { + String path = StringHelper.qualify( propertyHolder.getPath(), propertyName ); + ( new FkSecondPass( + value, joinColumns, + !optional, //cannot have nullabe and unique on certain DBs + path, mappings + ) ).doSecondPass( persistentClasses, inheritedMetas ); + //no column associated since its a one to one + propertyHolder.addProperty( prop ); + } + else { + //this is a many to one with Formula + + } + } + else { + PersistentClass otherSide = (PersistentClass) persistentClasses.get( value.getReferencedEntityName() ); + Property otherSideProperty; + try { + if ( otherSide == null ) { + throw new MappingException( "Unable to find entity: " + value.getReferencedEntityName() ); + } + otherSideProperty = otherSide.getProperty( mappedBy ); + } + catch (MappingException e) { + throw new AnnotationException( + "Unknown mappedBy in: " + StringHelper.qualify( ownerEntity, ownerProperty ) + + ", referenced property unknown: " + + StringHelper.qualify( value.getReferencedEntityName(), mappedBy ) + ); + } + if ( otherSideProperty.getValue() instanceof OneToOne ) { + propertyHolder.addProperty( prop ); + } + else if ( otherSideProperty.getValue() instanceof ManyToOne ) { + Iterator it = otherSide.getJoinIterator(); + Join otherSideJoin = null; + while ( it.hasNext() ) { + otherSideJoin = (Join) it.next(); + if ( otherSideJoin.containsProperty( otherSideProperty ) ) { + break; + } + } + if ( otherSideJoin != null ) { + //@OneToOne @JoinTable + Join mappedByJoin = buildJoin( + (PersistentClass) persistentClasses.get( ownerEntity ), otherSideProperty, otherSideJoin + ); + ManyToOne manyToOne = new ManyToOne( mappedByJoin.getTable() ); + //FIXME use ignore not found here + manyToOne.setIgnoreNotFound( ignoreNotFound ); + manyToOne.setCascadeDeleteEnabled( value.isCascadeDeleteEnabled() ); + manyToOne.setEmbedded( value.isEmbedded() ); + manyToOne.setFetchMode( value.getFetchMode() ); + manyToOne.setLazy( value.isLazy() ); + manyToOne.setReferencedEntityName( value.getReferencedEntityName() ); + manyToOne.setUnwrapProxy( value.isUnwrapProxy() ); + prop.setValue( manyToOne ); + Iterator otherSideJoinKeyColumns = otherSideJoin.getKey().getColumnIterator(); + while ( otherSideJoinKeyColumns.hasNext() ) { + Column column = (Column) otherSideJoinKeyColumns.next(); + Column copy = new Column(); + copy.setLength( column.getLength() ); + copy.setScale( column.getScale() ); + copy.setValue( manyToOne ); + copy.setName( column.getQuotedName() ); + copy.setNullable( column.isNullable() ); + copy.setPrecision( column.getPrecision() ); + copy.setUnique( column.isUnique() ); + copy.setSqlType( column.getSqlType() ); + copy.setCheckConstraint( column.getCheckConstraint() ); + copy.setComment( column.getComment() ); + copy.setDefaultValue( column.getDefaultValue() ); + manyToOne.addColumn( copy ); + } + mappedByJoin.addProperty( prop ); + } + else { + propertyHolder.addProperty( prop ); + } + + value.setReferencedPropertyName( mappedBy ); + + String propertyRef = value.getReferencedPropertyName(); + if ( propertyRef != null ) { + mappings.addUniquePropertyReference( + value.getReferencedEntityName(), + propertyRef + ); + } + } + else { + throw new AnnotationException( + "Referenced property not a (One|Many)ToOne: " + + StringHelper.qualify( + value.getReferencedEntityName(), value.getReferencedPropertyName() + ) + + " in mappedBy of " + + StringHelper.qualify( ownerEntity, ownerProperty ) + ); + } + } + } + + //dirty dupe of EntityBinder.bindSecondaryTable + private Join buildJoin(PersistentClass persistentClass, Property otherSideProperty, Join originalJoin) { + Join join = new Join(); + join.setPersistentClass( persistentClass ); + + //no check constraints available on joins + join.setTable( originalJoin.getTable() ); + join.setInverse( true ); + SimpleValue key = new DependantValue( join.getTable(), persistentClass.getIdentifier() ); + join.setKey( key ); + join.setSequentialSelect( false ); + join.setOptional( true ); //perhaps not quite per-spec, but a Good Thing anyway + key.setCascadeDeleteEnabled( false ); + Iterator mappedByColumns = otherSideProperty.getValue().getColumnIterator(); + while ( mappedByColumns.hasNext() ) { + Column column = (Column) mappedByColumns.next(); + Column copy = new Column(); + copy.setLength( column.getLength() ); + copy.setScale( column.getScale() ); + copy.setValue( key ); + copy.setName( column.getQuotedName() ); + copy.setNullable( column.isNullable() ); + copy.setPrecision( column.getPrecision() ); + copy.setUnique( column.isUnique() ); + copy.setSqlType( column.getSqlType() ); + copy.setCheckConstraint( column.getCheckConstraint() ); + copy.setComment( column.getComment() ); + copy.setDefaultValue( column.getDefaultValue() ); + key.addColumn( copy ); + } + join.createPrimaryKey(); + join.createForeignKey(); + persistentClass.addJoin( join ); + return join; + } +} + Property changes on: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/OneToOneSecondPass.java ___________________________________________________________________ Name: svn:keywords + Author Date Id Revision Name: svn:eol-style + native Deleted: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java 2006-05-01 21:40:41 UTC (rev 9846) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/ToOneMappedBySecondPass.java 2006-05-01 23:28:45 UTC (rev 9847) @@ -1,166 +0,0 @@ -//$Id$ -package org.hibernate.cfg; - -import java.util.Iterator; -import java.util.Map; - -import org.hibernate.AnnotationException; -import org.hibernate.MappingException; -import org.hibernate.mapping.Column; -import org.hibernate.mapping.DependantValue; -import org.hibernate.mapping.Join; -import org.hibernate.mapping.ManyToOne; -import org.hibernate.mapping.OneToOne; -import org.hibernate.mapping.PersistentClass; -import org.hibernate.mapping.Property; -import org.hibernate.mapping.SimpleValue; -import org.hibernate.mapping.ToOne; -import org.hibernate.util.StringHelper; - -public class ToOneMappedBySecondPass implements SecondPass { - private String mappedBy; - private ToOne value; - private ExtendedMappings mappings; - private String ownerEntity; - private String ownerProperty; - private PropertyHolder propertyHolder; - private Property property; - private boolean ignoreNotFound; - - public ToOneMappedBySecondPass( - String mappedBy, ToOne value, String ownerEntity, String ownerProperty, Property property, - PropertyHolder propertyHolder, boolean ignoreNotFound, - ExtendedMappings mappings - ) { - this.ownerEntity = ownerEntity; - this.ownerProperty = ownerProperty; - this.mappedBy = mappedBy; - this.value = value; - this.propertyHolder = propertyHolder; - this.mappings = mappings; - this.property = property; - this.ignoreNotFound = ignoreNotFound; - } - - public void doSecondPass(Map persistentClasses, Map inheritedMetas) throws MappingException { - PersistentClass otherSide = (PersistentClass) persistentClasses.get( value.getReferencedEntityName() ); - Property otherSideProperty; - try { - if ( otherSide == null ) { - throw new MappingException( "Unable to find entity: " + value.getReferencedEntityName() ); - } - otherSideProperty = otherSide.getProperty( mappedBy ); - } - catch (MappingException e) { - throw new AnnotationException( - "Unknown mappedBy in: " + StringHelper.qualify( ownerEntity, ownerProperty ) - + ", referenced property unknown: " - + StringHelper.qualify( value.getReferencedEntityName(), mappedBy ) - ); - } - if ( otherSideProperty.getValue() instanceof OneToOne ) { - propertyHolder.addProperty( property ); - } - else if ( otherSideProperty.getValue() instanceof ManyToOne ) { - Iterator it = otherSide.getJoinIterator(); - Join otherSideJoin = null; - while ( it.hasNext() ) { - otherSideJoin = (Join) it.next(); - if ( otherSideJoin.containsProperty( otherSideProperty ) ) { - break; - } - } - if ( otherSideJoin != null ) { - //@OneToOne @JoinTable - Join mappedByJoin = buildJoin( - (PersistentClass) persistentClasses.get( ownerEntity ), otherSideProperty, otherSideJoin - ); - ManyToOne manyToOne = new ManyToOne( mappedByJoin.getTable() ); - //FIXME use ignore not found here - manyToOne.setIgnoreNotFound( ignoreNotFound ); - manyToOne.setCascadeDeleteEnabled( value.isCascadeDeleteEnabled() ); - manyToOne.setEmbedded( value.isEmbedded() ); - manyToOne.setFetchMode( value.getFetchMode() ); - manyToOne.setLazy( value.isLazy() ); - manyToOne.setReferencedEntityName( value.getReferencedEntityName() ); - manyToOne.setUnwrapProxy( value.isUnwrapProxy() ); - property.setValue( manyToOne ); - Iterator otherSideJoinKeyColumns = otherSideJoin.getKey().getColumnIterator(); - while ( otherSideJoinKeyColumns.hasNext() ) { - Column column = (Column) otherSideJoinKeyColumns.next(); - Column copy = new Column(); - copy.setLength( column.getLength() ); - copy.setScale( column.getScale() ); - copy.setValue( manyToOne ); - copy.setName( column.getQuotedName() ); - copy.setNullable( column.isNullable() ); - copy.setPrecision( column.getPrecision() ); - copy.setUnique( column.isUnique() ); - copy.setSqlType( column.getSqlType() ); - copy.setCheckConstraint( column.getCheckConstraint() ); - copy.setComment( column.getComment() ); - copy.setDefaultValue( column.getDefaultValue() ); - manyToOne.addColumn( copy ); - } - mappedByJoin.addProperty( property ); - } - else { - propertyHolder.addProperty( property ); - } - - value.setReferencedPropertyName( mappedBy ); - - String propertyRef = value.getReferencedPropertyName(); - if ( propertyRef != null ) { - mappings.addUniquePropertyReference( - value.getReferencedEntityName(), - propertyRef - ); - } - } - else { - throw new AnnotationException( - "Referenced property not a (One|Many)ToOne: " - + StringHelper.qualify( value.getReferencedEntityName(), value.getReferencedPropertyName() ) - + " in mappedBy of " - + StringHelper.qualify( ownerEntity, ownerProperty ) - ); - } - } - - //dirty dupe of EntityBinder.bindSecondaryTable - private Join buildJoin(PersistentClass persistentClass, Property otherSideProperty, Join originalJoin) { - Join join = new Join(); - join.setPersistentClass( persistentClass ); - - //no check constraints available on joins - join.setTable( originalJoin.getTable() ); - join.setInverse( true ); - SimpleValue key = new DependantValue( join.getTable(), persistentClass.getIdentifier() ); - join.setKey( key ); - join.setSequentialSelect( false ); - join.setOptional( true ); //perhaps not quite per-spec, but a Good Thing anyway - key.setCascadeDeleteEnabled( false ); - Iterator mappedByColumns = otherSideProperty.getValue().getColumnIterator(); - while ( mappedByColumns.hasNext() ) { - Column column = (Column) mappedByColumns.next(); - Column copy = new Column(); - copy.setLength( column.getLength() ); - copy.setScale( column.getScale() ); - copy.setValue( key ); - copy.setName( column.getQuotedName() ); - copy.setNullable( column.isNullable() ); - copy.setPrecision( column.getPrecision() ); - copy.setUnique( column.isUnique() ); - copy.setSqlType( column.getSqlType() ); - copy.setCheckConstraint( column.getCheckConstraint() ); - copy.setComment( column.getComment() ); - copy.setDefaultValue( column.getDefaultValue() ); - key.addColumn( copy ); - } - join.createPrimaryKey(); - join.createForeignKey(); - persistentClass.addJoin( join ); - return join; - } -} Modified: trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java =================================================================== --- trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-05-01 21:40:41 UTC (rev 9846) +++ trunk/HibernateExt/metadata/src/java/org/hibernate/cfg/annotations/MapBinder.java 2006-05-01 23:28:45 UTC (rev 9847) @@ -81,6 +81,7 @@ Ejb3JoinColumn[] mapKeyManyToManyColumns ) { if ( mapKeyPropertyName != null ) { + //this is an EJB3 @MapKey PersistentClass associatedClass = (PersistentClass) persistentClasses.get( collType ); if ( associatedClass == null ) throw new AnnotationException( "Associated class not found: " + collType ); Property mapProperty = BinderHelper.findPropertyByName( associatedClass, mapKeyPropertyName ); @@ -94,7 +95,7 @@ map.setIndex( indexValue ); } else { - //throw new AnnotationException( "A Map must declare a @MapKey element" ); + //this is a true Map mapping //TODO ugly copy/pastle from CollectionBinder.bindManyToManySecondPass String mapKeyType = property.getMapKey().getName(); PersistentClass collectionEntity = (PersistentClass) persistentClasses.get( mapKeyType ); |