I have several questions involving paging with Sybase Anywhere. I believe I've read all the posts concerning paging with Hibernate, but I haven't run across any that pertain to Sybase Anywhere specifically.
My first question concerns the SybaseAnywhereDialect with Sybase 9.0. A few examples I've coded seem to work fine, however once I attempted to implement a paging example using Query.setMaxResults() and Query.setFirstResult() I received an exception:
Code:
FINE: SQL Exception
java.sql.SQLException: JZ0BT: The absolute(int) method is not supported for ResultSets of type TYPE_FORWARD_ONLY.
at com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:468)
at com.sybase.jdbc2.jdbc.SybResultSet.checkForScrollability(SybResultSet.java:1612)
at com.sybase.jdbc2.jdbc.SybResultSet.absolute(SybResultSet.java:648)
This resulted from the following calls with the Query class:
Code:
String queryString = "select reference from com.fedex.fsme.model.Reference reference order by reference.name";
Query query = session.createQuery(queryString);
query.setMaxResults(size);
query.setFirstResult((page - 1) * size);
return query.list();
If the SybaseAnywhereDialect is attempting to use absolute with the TYPE_FORWARD_ONLY result set type, I wouldn't imagine this works
with ASA version 8 either. Is this correct?
My second question is, if it is concluded that this is a bug in Hibernate, is there another method for performing paging?
My third question is, since Sybase 9 has introduced the ability to select with "START AT", are there plans to create a SybaseAnywhere9Dialect that takes advantage of this? I'm assuming this is more efficient than retrieving a FORWARD_ONLY result set and attempting to advance to the
specified offset.
I'll probably have more questions after Gavin answers these :)
Derek Greer