HHH-6405 - setFetchMode ignored in certain cases when using criteria queries

This commit is contained in:
Steve Ebersole 2012-04-23 12:05:56 -05:00
parent f12f2324c6
commit 60e92614be
1 changed files with 9 additions and 9 deletions

View File

@ -142,23 +142,23 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
String[] lhsColumns,
final boolean nullable,
final int currentDepth) throws MappingException {
JoinType ret;
final JoinType resolvedJoinType;
if ( translator.isJoin( path.getFullPath() ) ) {
ret = translator.getJoinType( path.getFullPath() );
resolvedJoinType = translator.getJoinType( path.getFullPath() );
}
else {
if ( translator.hasProjection() ) {
ret = JoinType.NONE;
resolvedJoinType = JoinType.NONE;
}
else {
FetchMode fetchMode = translator.getRootCriteria().getFetchMode( path.getFullPath() );
if ( isDefaultFetchMode( fetchMode ) ) {
if ( persister != null ) {
if ( isJoinFetchEnabledByProfile( persister, path, propertyNumber ) ) {
ret = getJoinType( nullable, currentDepth );
resolvedJoinType = getJoinType( nullable, currentDepth );
}
else {
ret = super.getJoinType(
resolvedJoinType = super.getJoinType(
persister,
path,
propertyNumber,
@ -173,7 +173,7 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
}
}
else {
ret = super.getJoinType(
resolvedJoinType = super.getJoinType(
associationType,
metadataFetchMode,
path,
@ -189,15 +189,15 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
else {
if ( fetchMode == FetchMode.JOIN ) {
isDuplicateAssociation( lhsTable, lhsColumns, associationType ); //deliberately ignore return value!
ret = getJoinType( nullable, currentDepth );
resolvedJoinType = getJoinType( nullable, currentDepth );
}
else {
ret = JoinType.NONE;
resolvedJoinType = JoinType.NONE;
}
}
}
}
return ret;
return resolvedJoinType;
}
protected JoinType getJoinType(