-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 
Author Message
 Post subject: Problems with offset in ScrollableResults
PostPosted: Fri Apr 16, 2004 4:06 am 
Newbie

Joined: Fri Apr 16, 2004 3:56 am
Posts: 4
Hi,

I read out pages of a ResultSet like this:
ScrollableResults sr = Interessent.getScrollableRS();
try {
sr.beforeFirst();
System.out.println("rownumber: "+sr.getRowNumber());
sr.setRowNumber(offset);
System.out.println("rownumber: "+sr.getRowNumber());

for (int i = 0; i < pageSize; i++){
Object[] inhalt = sr.get();
System.out.println("inhalt: "+inhalt[0]+" "+inhalt[1]+" "+inhalt[2]+" "+inhalt[3]+" "+inhalt[4]+" "+inhalt[5]+" "+inhalt[6]+" "+inhalt[7]);
int k = 0;
ergebnisListe.add(new SuchErgebnisInteressenten((String) inhalt[k++], (String) inhalt[k++], (String) inhalt[k++], (Calendar) inhalt[k++], (String) inhalt[k++], (String) inhalt[k++], (String) inhalt[k++], (String) inhalt[k++]));
sr.next();
}
sr.close();

If I want to get the second page out of the ResultSet I get the following error message:


ERROR [WorkerThread] (CommandDispatcher.java:373) - java.lang.NullPointerException
at com.mckoi.database.jdbc.MResultSet.columnCount(MResultSet.java:410)
at com.mckoi.database.jdbc.MResultSet.realIndexUpdate(MResultSet.java:614)
at com.mckoi.database.jdbc.MResultSet.absolute(MResultSet.java:1261)
at net.sf.hibernate.impl.ScrollableResultsImpl.setRowNumber(ScrollableResultsImpl.java:380)
at de.sv.kevus.controller.InteressentController.leseNaechsteSeite(InteressentController.java:238)
at de.sv.kevus.controller.CommandDispatcher.leseNaechsteSeite(CommandDispatcher.java:556)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at de.sv.kevus.controller.CommandDispatcher.executeCommand(CommandDispatcher.java:332)
at de.sv.kevus.client.connection.LocalBackendConnector$1.execute(LocalBackendConnector.java:92)
at de.sv.kevus.base.util.ObjectResultRunnable.run(ObjectResultRunnable.java:47)
at de.sv.kevus.base.util.WorkerThread.run(WorkerThread.java:60)
- StackTrace = java.lang.NullPointerException at com.mckoi.database.jdbc.MResultSet.columnCount(MResultSet.java:410) at com.mckoi.database.jdbc.MResultSet.realIndexUpdate(MResultSet.java:614) at com.mckoi.database.jdbc.MResultSet.absolute(MResultSet.java:1261) at net.sf.hibernate.impl.ScrollableResultsImpl.setRowNumber(ScrollableResultsImpl.java:380) at de.sv.kevus.controller.InteressentController.leseNaechsteSeite(InteressentController.java:238) at de.sv.kevus.controller.CommandDispatcher.leseNaechsteSeite(CommandDispatcher.java:556) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at de.sv.kevus.controller.CommandDispatcher.executeCommand(CommandDispatcher.java:332) at de.sv.kevus.client.connection.LocalBackendConnector$1.execute(LocalBackendConnector.java:92) at de.sv.kevus.base.util.ObjectResultRunnable.run(ObjectResultRunnable.java:47) at de.sv.kevus.base.util.WorkerThread.run(WorkerThread.java:60)

Why?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 16, 2004 5:26 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Reads like a driver bug to me. Why don't you just use setMaxResults setFirstResult?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 21, 2004 9:58 am 
Newbie

Joined: Fri Apr 16, 2004 3:56 am
Posts: 4
set FirstResult() / setMaxResults() works but seems to be quite slowly for more than 5000 datasets. Is there any faster solution?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.