This content has been marked as final.
Show 4 replies
-
1. Re: How to get a specific number of rows?
jaikiran Jan 27, 2008 3:43 AM (in response to hubaghdadi)Use setMaxResults() API on the Query object:
http://java.sun.com/javaee/5/docs/api/javax/persistence/Query.html#setMaxResults(int) -
2. Re: How to get a specific number of rows?
jaikiran Jan 27, 2008 3:44 AM (in response to hubaghdadi)If you are using plain Hibernate then the corresponding API is
http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Query.html#setMaxResults(int) -
3. Re: How to get a specific number of rows?
hubaghdadi Jan 27, 2008 3:48 AM (in response to hubaghdadi)Thanks man!
Would you please tell me how to achieve the same thing with native query?
AFAIK, PostgreSQL has a special syntax to specify how many rows to retrieve.
Thanks again. -
4. Re: How to get a specific number of rows?
jaikiran Jan 27, 2008 4:03 AM (in response to hubaghdadi)I haven't used PostgreSQL. The documentation for the select query http://www.postgresql.org/docs/8.1/interactive/sql-select.html shows that they have a LIMIT clause which can be used to achieve this. More details here:
http://www.postgresql.org/docs/8.1/interactive/sql-select.html#SQL-LIMIT