Hibernate version: 2.1.6
Mapping documents:
Code between sessionFactory.openSession() and session.close():
List list = session.find("select event from Event event where event.eventName like \"%vikas's%\"");
Full stack trace of any exception that occurs:
19:24:52,750 DEBUG [QueryTranslator] HQL: select event from com.xxx.Event event where event.eventName like "%vikas's%"
19:24:52,750 DEBUG [QueryTranslator] SQL: select event0_.ID as ID, event0_.DESCRIPTION as DESCRIPT4_,event0_.EVENTNAME as EVENTNAME, from EVENT event0_ where (event0_.EVENTNAME like "%vikas )
19:24:52,750 DEBUG [BatcherImpl] about to open: 0 open PreparedStatements, 0 open ResultSets
19:24:52,750 DEBUG [SQL] select event0_.ID as ID, event0_.DESCRIPTION as DESCRIPT4_, event0_.EVENTNAME as EVENTNAME from EVENT event0_ where (event0_.EVENTNAME like "%vikas )
19:24:52,750 INFO [STDOUT] Hibernate: select event0_.ID as ID, event0_.DESCRIPTION as DESCRIPT4_,event0_.EVENTNAME as EVENTNAME from EVENT event0_ where (event0_.EVENTNAME like "%vikas )
19:24:52,750 DEBUG [BatcherImpl] preparing statement
19:24:52,750 DEBUG [JDBCExceptionReporter] SQL Exception
java.sql.SQLException: Syntax error or access violation message from server: "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"%vikas )' at line 1"
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
at com.mysql.jdbc.Connection.execSQL(Connection.java:2247)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:314)
at net.sf.hibernate.impl.BatcherImpl.getResultSet(BatcherImpl.java:87)
at net.sf.hibernate.loader.Loader.getResultSet(Loader.java:875)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1544)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1521)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1513)
at com.xxx.event.EventSessionBean.searchEvents(EventSessionBean.java:496)
Name and version of the database you are using:
MySql 4.1.4-gamma-nt-log
The generated SQL (show_sql=true):
19:24:52,750 DEBUG [QueryTranslator] HQL: select event from com.xxxx.Event event where event.name like "%vikas's%" and event.accessLevel = "1"
Debug level Hibernate log excerpt:
I've found on google that a bug has been created for it , but I couldn't find if its fixed.
|