Hi,
I have a problem calling SQL functions from HQL, when using the new parser. Any help is welcome, thanks.
It seems that it is a problem of multiparameter queries only.
This worked well with the old parser:
Code:
...
in MyCustomSQLServerDialect, constructor:
registerFunction( "left", new StandardSQLFunction( "left", Hibernate.STRING) );
...
select left(areal.nazov,3) from Areal areal
...
With the new parser it causes parsing errors.
Hibernate version: 3.0.5
Mapping documents:Code between sessionFactory.openSession() and session.close():Full stack trace of any exception that occurs:org.hibernate.hql.ast.QuerySyntaxError: unexpected token: left near line 1, column 9 [select left(areal.nazov,3) from sk.spp.eis.beans.Areal areal]
at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:215)
at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:127)
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 sk.spp.eis.dev.StandaloneGUIHibernateTest.actionOK(StandaloneGUIHibernateTest.java:206)
at sk.spp.eis.dev.StandaloneGUIHibernateTest.actionPerformed(StandaloneGUIHibernateTest.java:161)
at java.awt.Button.processActionEvent(Unknown Source)
at java.awt.Button.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: line 1:9: unexpected token: left
at org.hibernate.hql.antlr.HqlBaseParser.selectClause(HqlBaseParser.java:962)
at org.hibernate.hql.antlr.HqlBaseParser.selectFrom(HqlBaseParser.java:735)
at org.hibernate.hql.antlr.HqlBaseParser.queryRule(HqlBaseParser.java:611)
at org.hibernate.hql.antlr.HqlBaseParser.selectStatement(HqlBaseParser.java:263)
at org.hibernate.hql.antlr.HqlBaseParser.statement(HqlBaseParser.java:150)
at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:209)
... 18 more
Name and version of the database you are using:The generated SQL (show_sql=true):Debug level Hibernate log excerpt:Code: