Hi Sander, Currently, jOOQ does not use that JDBC feature, but it would certainly make sense to think about it. There is already a method in the API allowing for fetching org.jooq.Cursor objects, which is shortly documented here: http://www.jooq.org/manual/JOOQ/ResultQuery/
The org.jooq.Cursor keeps an open java.sql.ResultSet internally, unlike org.jooq.Result, which loads the whole JDBC ResultSet into memory at once. It would probably make sense to overload the API with an optional parameter: // Don't change today's behaviour with this method Cursor ResultQuery.fetchLazy() // Overload fetchLazy() to specify the fetch size Cursor ResultQuery.fetchLazy(int) This will make it into jOOQ 2.0.3: https://sourceforge.net/apps/trac/jooq/ticket/1080 Cheers (and thanks for the good idea) Lukas 2012/1/27 Sander Plas <[email protected]>: > Hi, > > I just spent some time trying to figure out why java was caching a > huge result set in memory while i was using a cursor in jooq. > > It looks like that to get CURSORs to work correctly with PostgreSQL, > one needs to call "setFetchSize" with something > 0 on the JDBC > statement: > http://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor > . > > Is there a way to do this from/with jOOQ? > > Sander
