I have a very simple query with pagination like this

  | Query query = em.createQuery(ql);
  | query.setFirstResult(currentPage * itemsPerPage);//start rows
  | query.setMaxResults(itemsPerPage);//return rows
  | query.setParameter("searchValue", searchValue);//search criteria
  | return query.getResultList();       
  | 
it should genrate a SQL like 

  | select ... from table where ... limit 30, 10
  | 
but it always generates wrong SQL and hence throws out an exception:

  | Caused by: java.sql.SQLException: You have an error in your SQL syntax; 
check the manual that correspondsto your MySQL server version for the right 
syntax to use near 'limit 15 15 customer0_.ID as ID13_, customer0_.address as 
address13_, c
  | ustomer0_' at line 1
  | 
Why the "limit" keyword does not work?

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3914685#3914685

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3914685


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to