HHH-6405 - setFetchMode ignored in certain cases when using criteria queries
This commit is contained in:
parent
f12f2324c6
commit
60e92614be
|
@ -142,23 +142,23 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
|
||||||
String[] lhsColumns,
|
String[] lhsColumns,
|
||||||
final boolean nullable,
|
final boolean nullable,
|
||||||
final int currentDepth) throws MappingException {
|
final int currentDepth) throws MappingException {
|
||||||
JoinType ret;
|
final JoinType resolvedJoinType;
|
||||||
if ( translator.isJoin( path.getFullPath() ) ) {
|
if ( translator.isJoin( path.getFullPath() ) ) {
|
||||||
ret = translator.getJoinType( path.getFullPath() );
|
resolvedJoinType = translator.getJoinType( path.getFullPath() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( translator.hasProjection() ) {
|
if ( translator.hasProjection() ) {
|
||||||
ret = JoinType.NONE;
|
resolvedJoinType = JoinType.NONE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
FetchMode fetchMode = translator.getRootCriteria().getFetchMode( path.getFullPath() );
|
FetchMode fetchMode = translator.getRootCriteria().getFetchMode( path.getFullPath() );
|
||||||
if ( isDefaultFetchMode( fetchMode ) ) {
|
if ( isDefaultFetchMode( fetchMode ) ) {
|
||||||
if ( persister != null ) {
|
if ( persister != null ) {
|
||||||
if ( isJoinFetchEnabledByProfile( persister, path, propertyNumber ) ) {
|
if ( isJoinFetchEnabledByProfile( persister, path, propertyNumber ) ) {
|
||||||
ret = getJoinType( nullable, currentDepth );
|
resolvedJoinType = getJoinType( nullable, currentDepth );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = super.getJoinType(
|
resolvedJoinType = super.getJoinType(
|
||||||
persister,
|
persister,
|
||||||
path,
|
path,
|
||||||
propertyNumber,
|
propertyNumber,
|
||||||
|
@ -173,7 +173,7 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = super.getJoinType(
|
resolvedJoinType = super.getJoinType(
|
||||||
associationType,
|
associationType,
|
||||||
metadataFetchMode,
|
metadataFetchMode,
|
||||||
path,
|
path,
|
||||||
|
@ -189,15 +189,15 @@ public class CriteriaJoinWalker extends AbstractEntityJoinWalker {
|
||||||
else {
|
else {
|
||||||
if ( fetchMode == FetchMode.JOIN ) {
|
if ( fetchMode == FetchMode.JOIN ) {
|
||||||
isDuplicateAssociation( lhsTable, lhsColumns, associationType ); //deliberately ignore return value!
|
isDuplicateAssociation( lhsTable, lhsColumns, associationType ); //deliberately ignore return value!
|
||||||
ret = getJoinType( nullable, currentDepth );
|
resolvedJoinType = getJoinType( nullable, currentDepth );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ret = JoinType.NONE;
|
resolvedJoinType = JoinType.NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return resolvedJoinType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JoinType getJoinType(
|
protected JoinType getJoinType(
|
||||||
|
|
Loading…
Reference in New Issue