dev@glassfish.java.net

Re: javax.persistence.Query performance

From: Tom Ware <tom.ware_at_oracle.com>
Date: Wed, 20 Dec 2006 09:36:30 -0500

Hi Dmitry,

  Sorry for the late response.

  The current implementation of setFirstResult() and setMaxResult() make
use of JDBC constructs rather than RDBMS constructs.

  For setMaxResult() we call the java.sql.Statement.setMaxRows(int) method.

  For setFirstResult() we make use of the ResultSet that is returned in
JDBC. If firstResult is set, we build query that returns a
TYPE_SCROLL_INSENSITIVE ResultSet and call resultSet.absolute(int) on
that result set.

  Depending on the JDBC driver implementation, you are correct, this
could result in reduced performance.

  I suggest entering an Enhancement request to allow this feature to be
implemented with RDBMS operators.

-Tom



Dmitry Mozheyko wrote:

>Whether use methods:
>
>javax.persistence.Query.setFirstResult(int) and
>javax.persistence.Query.setMaxResults(int)
>
>such RDBMS-featured as operators SELECT... OFFSET X LIMIT Y?
>
>Their execution performance shows that is not present.
>
>Whether realization of it even for separate RDBMS is possible?
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>
>
>
>