Im having a problem with this code:
Query q = em.createQuery("SELECT object(o) FROM DetalleListaE o WHERE" +
" o.idLista =?1");
q.setParameter(1, listaE);
q.setFirstResult(1);
q.setMaxResults(5);
im trying to do some pagination using this methods, the problem is in line q.setMaxResults(5), i get this exception:
08:46:37,000 WARN [JDBCExceptionReporter] SQL Error: 0, SQLState: 42601
08:46:37,000 ERROR [JDBCExceptionReporter] ERROR: syntax error at or near "limit"
08:46:37,000 ERROR [STDERR] javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query
.....
...
..
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "limit"
08:46:37,062 ERROR [STDERR] at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:1525)
my db is postgres 8.x and im using driver postgresql-8.1-407.jdbc2ee with
jboss 4.0.4CR2.
any comment will be Appreciated.
|