Search in sources :

Example 1 with FunctionExpression

use of org.hibernate.sql.ast.tree.expression.FunctionExpression in project hibernate-orm by hibernate.

the class OracleSqlAstTranslator method visitOver.

@Override
public void visitOver(Over<?> over) {
    final Expression expression = over.getExpression();
    if (expression instanceof FunctionExpression && "row_number".equals(((FunctionExpression) expression).getFunctionName())) {
        if (over.getPartitions().isEmpty() && over.getOrderList().isEmpty() && over.getStartKind() == FrameKind.UNBOUNDED_PRECEDING && over.getEndKind() == FrameKind.CURRENT_ROW && over.getExclusion() == FrameExclusion.NO_OTHERS) {
            // Oracle doesn't allow an empty over clause for the row_number() function
            append("rownum");
            return;
        }
    }
    super.visitOver(over);
}
Also used : FunctionExpression(org.hibernate.sql.ast.tree.expression.FunctionExpression) BinaryArithmeticExpression(org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression) Expression(org.hibernate.sql.ast.tree.expression.Expression) FunctionExpression(org.hibernate.sql.ast.tree.expression.FunctionExpression) CaseSearchedExpression(org.hibernate.sql.ast.tree.expression.CaseSearchedExpression)

Aggregations

BinaryArithmeticExpression (org.hibernate.sql.ast.tree.expression.BinaryArithmeticExpression)1 CaseSearchedExpression (org.hibernate.sql.ast.tree.expression.CaseSearchedExpression)1 Expression (org.hibernate.sql.ast.tree.expression.Expression)1 FunctionExpression (org.hibernate.sql.ast.tree.expression.FunctionExpression)1