com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException seting setMaxResults

Description

When try to set setFirstResult or setMaxResults in a Criteria the following exception appear

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'limit 10 10 this_.id as id3_0_, this_.title as title3_0_, this_.public as public' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1031)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1837)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1961)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2543)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1737)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1888)
at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
at org.hibernate.loader.Loader.getResultSet(Loader.java:1778)
at org.hibernate.loader.Loader.doQuery(Loader.java:662)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
at org.hibernate.loader.Loader.doList(Loader.java:2211)
... 79 more

I tryed set up the following parameter in SQL String but doesn´t work

useServerPrepStmts=false
emulateUnsupportedPstmts=false

Activity

Steve EbersoleMarch 21, 2011 at 7:04 PM

Bulk closing stale resolved issues

IgnacioINovember 18, 2007 at 8:30 PM

I installed the lastest version of hibernate (3.2.5ga) and the issue was solved.

Thanks a lot!
Ignacio

IgnacioINovember 17, 2007 at 9:33 PM

In this forum there is an example of this issue

http://forums.mysql.com/read.php?39,88025,88025

Regards,
Ignacio

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created November 17, 2007 at 9:27 PM
Updated March 21, 2011 at 7:04 PM
Resolved November 20, 2007 at 3:40 PM

Flag notifications