0

I'm trying to call a function in a named query, but im getting :

java.lang.IllegalStateException: No data type for node:     org.hibernate.hql.ast.tree.MethodNode 
 \-[METHOD_CALL] MethodNode: '('
    +-[METHOD_NAME] IdentNode: 'MYFUNCTION' {originalText=MYFUNCTION}
    \-[EXPR_LIST] SqlNode: 'exprList'
       \-[NUM_INT] LiteralNode: '1'

and my query is something like

@NamedQuery(name = "myQuery",
            query = " select r, MYFUNCTION(r.id) from ResPO r "
                + " where  r.status like 'A'")

If I simplify my query, all is ok:

@NamedQuery(name = "myQuery",
        query = " select r from ResPO r "
            + " where  r.status like 'A'")

What is the mistake? Thanks++

1 Answer 1

1

You can do it by extending the dialect you're using and registering your function by calling the registerFunction() method.

http://docs.jboss.org/hibernate/orm/3.5/api/org/hibernate/dialect/Dialect.html#registerFunction%28java.lang.String,%20org.hibernate.dialect.function.SQLFunction%29

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.