Fix some query caching issue related to pagination parameters and a small case sensitivity issue

This commit is contained in:
Christian Beikov 2021-09-01 21:19:25 +02:00
parent 59fbdb9039
commit ea099e7e85
4 changed files with 5 additions and 5 deletions

View File

@ -78,7 +78,7 @@ public class OracleSqlAstTranslator<T extends JdbcOperation> extends AbstractSql
} }
if ( strategy != LockStrategy.FOLLOW_ON ) { if ( strategy != LockStrategy.FOLLOW_ON ) {
final boolean hasOffset; final boolean hasOffset;
if ( querySpec.isRoot() && hasLimit() && getLimit().getFirstRowJpa() != 0 ) { if ( querySpec.isRoot() && hasLimit() && getLimit().getFirstRow() != null ) {
hasOffset = true; hasOffset = true;
// We must record that the generated SQL depends on the fact that there is an offset // We must record that the generated SQL depends on the fact that there is an offset
addAppliedParameterBinding( getOffsetParameter(), null ); addAppliedParameterBinding( getOffsetParameter(), null );

View File

@ -135,8 +135,8 @@ public class SQLServerSqlAstTranslator<T extends JdbcOperation> extends Abstract
final boolean hasLimit; final boolean hasLimit;
final boolean hasOffset; final boolean hasOffset;
if ( queryPart.isRoot() && hasLimit() ) { if ( queryPart.isRoot() && hasLimit() ) {
hasLimit = getLimit().getMaxRowsJpa() != Integer.MAX_VALUE; hasLimit = getLimit().getMaxRows() != null;
hasOffset = getLimit().getFirstRowJpa() != 0; hasOffset = getLimit().getFirstRow() != null;
} }
else { else {
hasLimit = queryPart.getFetchClauseExpression() != null; hasLimit = queryPart.getFetchClauseExpression() != null;

View File

@ -411,7 +411,7 @@ public abstract class AbstractSqlAstTranslator<T extends JdbcOperation> implemen
} }
protected boolean hasOffset(QueryPart queryPart) { protected boolean hasOffset(QueryPart queryPart) {
if ( queryPart.isRoot() && hasLimit() && limit.getFirstRowJpa() != 0 ) { if ( queryPart.isRoot() && hasLimit() && limit.getFirstRow() != null ) {
return true; return true;
} }
else { else {

View File

@ -104,7 +104,7 @@ public class UnspecifiedEnumTypeTest extends BaseEnversFunctionalTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
List<Object[]> values = session List<Object[]> values = session
.createNativeQuery( "SELECT enum1 e1, enum2 e2 FROM ENUM_ENTITY_AUD ORDER BY rev ASC" ) .createNativeQuery( "SELECT enum1 e1, enum2 e2 FROM ENUM_ENTITY_AUD ORDER BY REV ASC" )
.addScalar( "e1", IntegerType.INSTANCE ) .addScalar( "e1", IntegerType.INSTANCE )
.addScalar( "e2", IntegerType.INSTANCE ) .addScalar( "e2", IntegerType.INSTANCE )
.list(); .list();