Hi all, Is the first time that I use Hibernate in a web application project, I have a problem using "HQL Query". The "Hibernate Mapping Files and POJOs" and HibernateUtil are created by wizard.
IDE: NetBeans 6.5.1
Frameworks used: Spring web MVC 2.5 Struts 2 Hibernate 3.2.5
Informix drivers: ifxjdbc.jar ifxjdbcx.jar ifxlang.jar ifxlsupp.jar ifxsqlj.jar ifxtools.jar
hibernate.cfg.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="hibernate.dialect">org.hibernate.dialect.InformixDialect</property> <property name="hibernate.connection.driver_class">com.informix.jdbc.IfxDriver</property> <property name="hibernate.connection.url">jdbc:informix-sqli://atmsrv26:1526/dbprova:informixserver=csaol1tcpw</property> <property name="hibernate.connection.username">XXXX</property> <property name="hibernate.connection.password">YYYYYYYY</property> <property name="hibernate.show_sql">true</property> <property name="hibernate.current_session_context_class">thread</property> <mapping resource="hib/Tbutenti.hbm.xml"/> <mapping resource="hib/Tbcenlav.hbm.xml"/> <mapping resource="hib/Tbprofil.hbm.xml"/> </session-factory> </hibernate-configuration>
hibernate.reveng.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd"> <hibernate-reverse-engineering> <schema-selection match-catalog="dbprova" match-schema="DBPROVA"/> <table-filter match-name="tbcenlav"/> <table-filter match-name="tbprofil"/> <table-filter match-name="tbutenti"/> </hibernate-reverse-engineering>
query: from Tbutenti
SQL: select tbutenti0_.idutente as col_0_0_ from dbprova.DBPROVA.tbutenti tbutenti0_
error: org.hibernate.exception.SQLGrammarException: could not execute query at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.loader.Loader.doList(Loader.java:2223) at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104) at org.hibernate.loader.Loader.list(Loader.java:2099) at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378) at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338) at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121) at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79) Caused by: java.sql.SQLException: A syntax error has occurred. at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373) at com.informix.jdbc.IfxSqli.a(IfxSqli.java:3208) at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3518) at com.informix.jdbc.IfxSqli.dispatchMsg(IfxSqli.java:2353) at com.informix.jdbc.IfxSqli.receiveMessage(IfxSqli.java:2269) at com.informix.jdbc.IfxSqli.executePrepare(IfxSqli.java:1153) at com.informix.jdbc.IfxPreparedStatement.e(IfxPreparedStatement.java:318) at com.informix.jdbc.IfxPreparedStatement.a(IfxPreparedStatement.java:298) at com.informix.jdbc.IfxPreparedStatement.<init>(IfxPreparedStatement.java:168) at com.informix.jdbc.IfxSqliConnect.h(IfxSqliConnect.java:5918) at com.informix.jdbc.IfxSqliConnect.prepareStatement(IfxSqliConnect.java:1999) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:505) at org.hibernate.jdbc.AbstractBatcher.getPreparedStatement(AbstractBatcher.java:423) at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:139) at org.hibernate.loader.Loader.prepareQueryStatement(Loader.java:1547) at org.hibernate.loader.Loader.doQuery(Loader.java:673) at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236) at org.hibernate.loader.Loader.doList(Loader.java:2220) ... 9 more Caused by: java.sql.SQLException at com.informix.util.IfxErrMsg.getSQLException(IfxErrMsg.java:373) at com.informix.jdbc.IfxSqli.E(IfxSqli.java:3523) ... 24 more
Can we help me ? Thanks
|