Grokbase Groups Cayenne dev May 2009
FAQ
Now when I know of this JDBC feature, I'd prefer to have it in Cayenne
sooner that later. We would also want to have it for other queries than just
only SelectQuery. Could someone help me testing it against different types
of database if I commit?

2009/5/20 stefcl <stefatwork@gmail.com>
I have posted a small fix in the jira.


I added the following in SelectQuery.java :
***************************************
//quick fix : property for setting the jdbc fetch size

protected Integer cursorFetchSize;

/**
* Gets the JDBC fetch size for this query.
* @return the fetch size defined for this query, null if not set.
*/
public Integer getCursorFetchSize()
{
return cursorFetchSize;
}


/**
* Sets the JDBC fetch size for this query.
* @param cursorFetchSize the desired fetch size, or null to reset
it.
*/
public void setCursorFetchSize(Integer cursorFetchSize)
{
this.cursorFetchSize = cursorFetchSize;
}

//end quick fix
************************************

And modified SelectAction.java to add the check in performAction :
public void performAction(Connection connection, OperationObserver
observer)
throws SQLException, Exception {

long t1 = System.currentTimeMillis();

SelectTranslator translator = createTranslator(connection);
PreparedStatement prepStmt = translator.createStatement();

//quick fix : sets the fetch size
if( query.getCursorFetchSize() != null )
prepStmt.setFetchSize( query.getCursorFetchSize() );
//quick fix end

ResultSet rs = prepStmt.executeQuery();
QueryMetadata md = query.getMetaData(getEntityResolver());

(...)

********************************************************




--
View this message in context:
http://www.nabble.com/Big-selects-on-PostGres-%3A-Configuring-Statement.setFetchSize%28%29-of-a-selectquery-tp23555842p23635409.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 11 | next ›
Discussion Overview
groupdev @
categoriescayenne
postedMay 21, '09 at 12:59p
activeMay 25, '09 at 10:40a
posts11
users3
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase