You are viewing a plain text version of this content. The canonical link for it is here.
Posted to torque-user@db.apache.org by Kenji Ichikawa <ic...@seta.co.jp> on 2005/04/05 04:00:30 UTC

How to fetch the rows with Peer class

Hello, I'm ichikawa.

I would like to implement to fetch the rows with Peer class of Torque,
becase the table row size is too large, so probably OutOfMemoryError
will heppen if the following code is executed.



Criteria criteria = new Criteria();
List list = MyTablePeer.doSelect( criteria );



I would like to know how to fetch the rows with Peer class,
it's like the following code of JDBC implementation.



Statement st = conn.createStatement();
st.setFetchSize(50);
ResultSet rs = st.executeQuery("SELECT * FROM my_table");
while (rs.next()) {
    System.out.print("a row was returned.");
}
rs.close();
st.close();



If you know how to do, Could you give me advice ?





---------------------------
Kenji Ichikawa
mailto:ichikawa@seta.co.jp
http://www.seta.co.jp/ 


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


Re: How to fetch the rows with Peer class

Posted by Scott Eade <se...@backstagetech.com.au>.
Kenji Ichikawa wrote:

> I would like to implement to fetch the rows with Peer class of Torque,
> becase the table row size is too large, so probably OutOfMemoryError
> will heppen if the following code is executed.
>
> Criteria criteria = new Criteria();
> List list = MyTablePeer.doSelect( criteria );
>
> I would like to know how to fetch the rows with Peer class,
> it's like the following code of JDBC implementation.
>
> Statement st = conn.createStatement();
> st.setFetchSize(50);
> ResultSet rs = st.executeQuery("SELECT * FROM my_table");
> while (rs.next()) {
>    System.out.print("a row was returned.");
> }
> rs.close();
> st.close();
>
> If you know how to do, Could you give me advice ?


What you really need is the LargeSelect class - look at the JavaDoc and 
test cases for usage.

Scott

-- 
Scott Eade
Backstage Technologies Pty. Ltd.
http://www.backstagetech.com.au


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org


RE: How to fetch the rows with Peer class

Posted by Thomas Fischer <fi...@seitenbau.net>.



Hi,

you can use the criteria.setLimit() and setOffset() methods to limit the
numbers of datasets to retrieve. Then you can iterate through the whole
table by increasing the offset in a loop, until you find no more datasets.

Hope that is what you were looking for.

     Thomas

Kenji Ichikawa <ic...@seta.co.jp> schrieb am 05.04.2005 04:00:30:

>
> Hello, I'm ichikawa.
>
> I would like to implement to fetch the rows with Peer class of Torque,
> becase the table row size is too large, so probably OutOfMemoryError
> will heppen if the following code is executed.
>
>
>
> Criteria criteria = new Criteria();
> List list = MyTablePeer.doSelect( criteria );
>
>
>
> I would like to know how to fetch the rows with Peer class,
> it's like the following code of JDBC implementation.
>
>
>
> Statement st = conn.createStatement();
> st.setFetchSize(50);
> ResultSet rs = st.executeQuery("SELECT * FROM my_table");
> while (rs.next()) {
>     System.out.print("a row was returned.");
> }
> rs.close();
> st.close();
>
>
>
> If you know how to do, Could you give me advice ?
>
>
>
>
>
> ---------------------------
> Kenji Ichikawa
> mailto:ichikawa@seta.co.jp
> http://www.seta.co.jp/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
> For additional commands, e-mail: torque-user-help@db.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: torque-user-unsubscribe@db.apache.org
For additional commands, e-mail: torque-user-help@db.apache.org