HHH-18439 Account for null values in query cache hit
Also, solve an assertion error in query result type check when selecting `null` literals
This commit is contained in:
parent
4bf11f8503
commit
a784ca2027
|
@ -1094,7 +1094,10 @@ public class SqmUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
final JavaType<?> selectionExpressibleJavaType = selectionExpressible.getExpressibleJavaType();
|
final JavaType<?> selectionExpressibleJavaType = selectionExpressible.getExpressibleJavaType();
|
||||||
assert selectionExpressibleJavaType != null;
|
if ( selectionExpressibleJavaType == null ) {
|
||||||
|
// nothing we can validate
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
final Class<?> selectionExpressibleJavaTypeClass = selectionExpressibleJavaType.getJavaTypeClass();
|
final Class<?> selectionExpressibleJavaTypeClass = selectionExpressibleJavaType.getJavaTypeClass();
|
||||||
if ( selectionExpressibleJavaTypeClass != Object.class ) {
|
if ( selectionExpressibleJavaTypeClass != Object.class ) {
|
||||||
|
@ -1103,7 +1106,7 @@ public class SqmUtil {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( selectionExpressibleJavaType instanceof PrimitiveJavaType<?> primitiveJavaType ) {
|
if ( selectionExpressibleJavaType instanceof final PrimitiveJavaType<?> primitiveJavaType ) {
|
||||||
if ( primitiveJavaType.getPrimitiveClass() == resultClass ) {
|
if ( primitiveJavaType.getPrimitiveClass() == resultClass ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -176,12 +176,12 @@ public class JdbcValuesCacheHit extends AbstractJdbcValues {
|
||||||
if ( valueIndexesToCacheIndexes == null ) {
|
if ( valueIndexesToCacheIndexes == null ) {
|
||||||
return ( (Object[]) row )[valueIndex];
|
return ( (Object[]) row )[valueIndex];
|
||||||
}
|
}
|
||||||
else if ( row.getClass() != Object[].class ) {
|
else if ( row instanceof Object[] ) {
|
||||||
assert valueIndexesToCacheIndexes[valueIndex] == 0;
|
return ( (Object[]) row )[valueIndexesToCacheIndexes[valueIndex]];
|
||||||
return row;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return ( (Object[]) row )[valueIndexesToCacheIndexes[valueIndex]];
|
assert valueIndexesToCacheIndexes[valueIndex] == 0;
|
||||||
|
return row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue