From b2692620d714870e8df58dd469c22c21d9431594 Mon Sep 17 00:00:00 2001 From: Gail Badner Date: Wed, 27 Jul 2011 13:58:30 -0700 Subject: [PATCH] HHH-6497 : Update AbstractEntityPersister to use AssociationAttributeBinding.getCascadeStyle() and getFetchMode() --- .../entity/AbstractEntityPersister.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 605a2c6c88..0fbc07c88c 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -95,6 +95,7 @@ import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; import org.hibernate.mapping.Selectable; import org.hibernate.metadata.ClassMetadata; +import org.hibernate.metamodel.binding.AssociationAttributeBinding; import org.hibernate.metamodel.binding.AttributeBinding; import org.hibernate.metamodel.binding.EntityBinding; import org.hibernate.metamodel.binding.SimpleValueBinding; @@ -1038,12 +1039,16 @@ public abstract class AbstractEntityPersister propColumnNumbers.add( colnos ); propFormulaNumbers.add( formnos ); - // TODO: fix this when HHH-6357 is fixed; for now, assume FetchMode.DEFAULT - //joinedFetchesList.add( singularAttributeBinding.getValue().getFetchMode() ); - joinedFetchesList.add( FetchMode.DEFAULT ); - // TODO: fix this when HHH-6355 is fixed; for now assume CascadeStyle.NONE - //cascades.add( singularAttributeBinding.getCascadeStyle() ); - cascades.add( CascadeStyle.NONE ); + if ( singularAttributeBinding.isAssociation() ) { + AssociationAttributeBinding associationAttributeBinding = + ( AssociationAttributeBinding ) singularAttributeBinding; + cascades.add( associationAttributeBinding.getCascadeStyle() ); + joinedFetchesList.add( associationAttributeBinding.getFetchMode() ); + } + else { + cascades.add( CascadeStyle.NONE ); + joinedFetchesList.add( FetchMode.SELECT ); + } } subclassColumnClosure = ArrayHelper.toStringArray( columns );