Bug 158 : Query syntax not support "LIMIT {max rows} [ OFFSET {first row} ] " but support "LIMIT {max rows}"
Priority 
High
Reported Version 
 
Logged By 
wstone
Status 
Fixed
Fixed Version 
2.2.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
22/09/2009
Updated 
22/09/2009
Type 
Bug
 
Attachments 
No attachments

my code:
Query query = ebeanServer.createQuery(wjw.ebean.dao.Log4jEdi.class);
query.setQuery("find Log4jEdi where logLevel like :A and logThread=:B limit 100 offset 3");
query.setParameter("A","INF%");
query.setParameter("B","TPool-7");

List list = query
.setFirstRow(3)
.findList();
System.out.println(list);

Exception:
INFO: Ebean Version[2.1.0-20090914] Java Version[1.6.0_12]
javax.persistence.PersistenceException: Query expected 'join', 'where','order by' or 'limit' keyword but got [3]
find Log4jEdi where logLevel like :A and logThread=:B limit 100 offset 3
at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.process(OrmQueryDetailParser.java:67)
at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.processInitial(OrmQueryDetailParser.java:48)
at com.avaje.ebean.server.querydefn.OrmQueryDetailParser.parse(OrmQueryDetailParser.java:29)
at com.avaje.ebean.server.querydefn.DefaultOrmQuery.setQuery(DefaultOrmQuery.java:603)
at com.avaje.ebean.server.querydefn.DefaultOrmQuery.setQuery(DefaultOrmQuery.java:41)
at wjw.ebean.test.TestB.findUseSetQuery2(TestB.java:50)
at wjw.ebean.test.TestB.main(TestB.java:66)

 
Rob 28 Sep 08:28
Reproduced

Thanks, I have reproduced as a Testcase. Investigating now.

Rob 28 Sep 09:52
Fixed in HEAD

Fixed in HEAD.

Issue was with the OrmQueryDetailParser.

Rob 28 Sep 09:57
Also noted and fixed

The limit value was bigger than it needed to be. Had no effect on the query result as max limit hit and extra results not read but less efficient queries where being produced.

woResponse

Upload a file