-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Using Criteria.setMaxResult() with MySQL
PostPosted: Thu Feb 11, 2010 2:41 pm 
Newbie

Joined: Thu Feb 11, 2010 2:20 pm
Posts: 1
I am trying to use
criteria.setFirstResult(15);
criteria.setMaxResults(50); with MySql DB. But it generate a wrong sql . It put 'top' keyword after "SELECT". Hibernate version I am using is hibernate-3.3.1.jar
eg:
select top 65 this_.id as id193_0_, this_.abbr as abbr193_0_, this_.nickname as nickname193_0_, this_.business as business193_0_, this_.country as country193_0_, this_.name as name193_0_, this_.attn as attn193_0_, this_.dept as dept193_0_, this_.street as street193_0_, this_.city as city193_0_, this_.phone as phone193_0_, this_.fax as fax193_0_, this_.telex as telex193_0_, this_.limccy as limccy193_0_, this_.exlimit as exlimit193_0_, this_.dellimit as dellimit193_0_, this_.broccy as broccy193_0_, this_.brobasis as brobasis193_0_, this_.fxbrorate as fxbrorate193_0_, this_.optbrorate as optbrorate193_0_, this_.parent as parent193_0_, this_.reuters as reuters193_0_, this_.reference as reference193_0_, this_.tradeable as tradeable193_0_, this_.amenddate as amenddate193_0_, this_.email as email193_0_ from names this_

Exception received is 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 '65 this_.id as id193_0_, this_.abbr as abbr193_0_, this_.nickname as nickname193' at line 1

Please provide a solution to resolve this.

Thanks,
SD


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.