What does em.createNativeQuery() have to do with query pagination?  The dialects handle this so you don't need to worry about the weird stuff that ORACLE, MySQL, and SQL Server need.  This is what you want:
http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html#objectstate-querying-executing-pagination
 
This stuff has been in Hibernate since 2.x.


From: Dave [mailto:[EMAIL PROTECTED]
Sent: Friday, September 09, 2005 10:19 PM
To: MyFaces Discussion
Subject: Re: dataTable - Millions of records

I am not sure if Hibernate support this. Right now em.createNativeQuery() is not implemented.

David Haynes <[EMAIL PROTECTED]> wrote:
Most relational databases have the ability to return a sub-set of the
entire result set.
SQL allows you to say something like 'WHERE rownum > skip AND rownum <=
(skip+n)'.
Some databases use an alternate syntax to achieve the same result.
(e.g. MySQL uses 'OFFSET skip LIMIT n')

As Mike Kienenberger pointed out earlier today in his reply, the
dataTable tag supports this via the parameters 'first=skip rows=n' and
those values (skip and n) can be made available to your backing bean.
So, you can code the SQL query (in JDBC or Hibernate or what-ever) to
honour the skip and n values.

-david-

Dave wrote:

>
> Does JDBC execute query return the whole set of records in memory? do
> you mean data model in JDBC library? Thanks!
> */Werner Punz <[EMAIL PROTECTED]>/* wrote:
>
> Dave wrote:
> ; > For a large database table that has millions of records(rows),
> how is
> > the memory managed from backend to ? all the millions of
> > records are in memory? That would crash the system. Is the
> collection(
> > returned from database layer) actually not filled with data
> until they
> > are requested ? Thanks. Dave
> >
> implementing a custom datamodel might be your friend in this case...
> unless you use plain jdbc, afair there was a jdbc datamodel in the
> core classes.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>



Click here to donate to the Hurricane Katrina relief effort.

Reply via email to