Hibernate version: 3.0.5
I want to use a Microsoft SQL server user defined user function from Hibernate, in HQL statement in a report query.
Code between sessionFactory.openSession() and session.close():
Query theQuery9 = session.createQuery("select dbo.funDecrypt(df.ccriteria3Dfr,'ABCDEFGH') from DataformIrmdfr df");
Full stack trace of any exception that occurs:
java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.MethodNode
+-[METHOD_CALL] MethodNode: '('
| \-[METHOD_NAME] SqlNode: 'exprList'
| +-[DOT] DotNode: 'dataformir0_.CCRITERIA3_DFR' {propertyName=ccriteria3Dfr,dereferenceType=4,propertyPath=ccriteria3Dfr,path=df.ccriteria3Dfr,tableAlias=dataformir0_,className=com.atosorigin.mev.gms.irm.hibernate.business.objects.DataformIrmdfr,classAlias=df}
| | +-[ALIAS_REF] IdentNode: '(dataformir0_.NIDENTIFIER_DFRFRM, dataformir0_.NIDENTIFIER_DFR)' {alias=df, className=com.atosorigin.mev.gms.irm.hibernate.business.objects.DataformIrmdfr, tableAlias=dataformir0_}
| | \-[IDENT] IdentNode: 'ccriteria3Dfr' {originalText=ccriteria3Dfr}
| \-[QUOTED_STRING] LiteralNode: ''ABCDEFGH''
at org.hibernate.hql.ast.SelectClause.initializeExplicitSelectClause(SelectClause.java:136)
at org.hibernate.hql.ast.HqlSqlWalker.useSelectClause(HqlSqlWalker.java:440)
at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:351)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:126)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:471)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201)
at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151)
at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at test.main(test.java:179)
Name and version of the database I'm using:
Microsoft SQL Server 2000
I try with the non user defined functions (ex. ltrim function) and the HQL works correctly:
Query theQuery9 = session.createQuery("select ltrim(df.ccriteria3Dfr) from DataformIrmdfr df");
Can someone help me ??
Thanks,
|