Re: Big selects on PostGres : Configuring Statement.setFetchSize() of a selectquery

From: stefcl (stefatwor..mail.com)
Date: Wed May 20 2009 - 09:24:28 EDT

  • Next message: Dave Lamy: "Determining objects affected by a delete"

    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.
            *..eturn the fetch size defined for this query, null if not set.
            */
            public Integer getCursorFetchSize()
            {
                    return cursorFetchSize;
            }
            
            
            /**
            * Sets the JDBC fetch size for this query.
            *..aram 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.
    



    This archive was generated by hypermail 2.0.0 : Wed May 20 2009 - 09:25:05 EDT