Skip to content

Commit f7fc94c

Browse files
committed
HHH-19314 Fix fetch clause expression value retrieval
1 parent 774969d commit f7fc94c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -6853,9 +6853,12 @@ private int getSortSelectionIndex(QuerySpec querySpec, SortSpecification sortSpe
68536853

68546854
private boolean isFetchFirstRowOnly(QueryPart queryPart) {
68556855
return queryPart.getFetchClauseType() == FetchClauseType.ROWS_ONLY
6856-
&& queryPart.getFetchClauseExpression() instanceof QueryLiteral<?>
6857-
&& Integer.valueOf( 1 )
6858-
.equals( ( (QueryLiteral<?>) queryPart.getFetchClauseExpression() ).getLiteralValue() );
6856+
&& queryPart.getFetchClauseExpression() != null
6857+
&& Integer.valueOf( 1 ).equals( getLiteralValue( queryPart.getFetchClauseExpression() ) );
6858+
}
6859+
6860+
public <X> X getLiteralValue(Expression expression) {
6861+
return interpretExpression( expression, jdbcParameterBindings );
68596862
}
68606863

68616864
private SelectStatement stripToSelectClause(SelectStatement statement) {

0 commit comments

Comments
 (0)