*
The moose likes Object Relational Mapping and the fly likes entityManager produces incorrect SQL when using limit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "entityManager produces incorrect SQL when using limit" Watch "entityManager produces incorrect SQL when using limit" New topic
Author

entityManager produces incorrect SQL when using limit

Erik Deveza
Greenhorn

Joined: Feb 21, 2011
Posts: 15
Hi,

I am using javax.persistence.EntityManager to query my table. My query.getResultList() works perfectly when using setFirstResult method, but when I use setMaxResults method, it produces the following error:



When I checked the actual query the limit keyword is placed right after the SELECT keyword, it should be after the statement. Why is the entityManager producing incorrect statement? I am currently using MySQLDialect. I also tried MySQLMyISAMDialect and MySQLInnoDBDialect, but it didn't work as well.

Any input is highly regarded.
Erik Deveza
Greenhorn

Joined: Feb 21, 2011
Posts: 15
After double checking my config file, hibernate.dialect was set to "org.hibernate.dialect.HSQLDialect".
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: entityManager produces incorrect SQL when using limit
 
Similar Threads
does OracleDriver really precompile a PreparedStatement?
Insert image into MySQL database
apostrophe ( ' ) issue in SQL of Hibernate.
SQL Dates
preparedStatement error