Return-Path: Delivered-To: apmail-db-ojb-dev-archive@www.apache.org Received: (qmail 73179 invoked from network); 25 Jul 2004 00:18:52 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 25 Jul 2004 00:18:52 -0000 Received: (qmail 54250 invoked by uid 500); 25 Jul 2004 00:18:51 -0000 Delivered-To: apmail-db-ojb-dev-archive@db.apache.org Received: (qmail 54193 invoked by uid 500); 25 Jul 2004 00:18:51 -0000 Mailing-List: contact ojb-dev-help@db.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "OJB Developers List" Reply-To: "OJB Developers List" Delivered-To: mailing list ojb-dev@db.apache.org Received: (qmail 54177 invoked by uid 500); 25 Jul 2004 00:18:51 -0000 Received: (qmail 54173 invoked by uid 99); 25 Jul 2004 00:18:51 -0000 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.27.1) with SMTP; Sat, 24 Jul 2004 17:18:50 -0700 Received: (qmail 73162 invoked by uid 1510); 25 Jul 2004 00:18:50 -0000 Date: 25 Jul 2004 00:18:50 -0000 Message-ID: <20040725001850.73161.qmail@minotaur.apache.org> From: arminw@apache.org To: db-ojb-cvs@apache.org Subject: cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer RsIterator.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N arminw 2004/07/24 17:18:50 Modified: src/java/org/apache/ojb/broker/accesslayer RsIterator.java Log: minor performance improvement: first map PK values only from result set and check against the cache, before map all field values from result set to internal Map class. Revision Changes Path 1.65 +15 -13 db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java Index: RsIterator.java =================================================================== RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RsIterator.java,v retrieving revision 1.64 retrieving revision 1.65 diff -u -r1.64 -r1.65 --- RsIterator.java 23 Jul 2004 11:40:03 -0000 1.64 +++ RsIterator.java 25 Jul 2004 00:18:50 -0000 1.65 @@ -415,19 +415,17 @@ * itemProxyClass should NOT be a member variable. */ + // in any case we need the PK values of result set row + // provide m_row with primary key data of current row + getQueryObject().getClassDescriptor().getRowReader().readPkValuesFrom(getRsAndStmt().m_rs, getRow()); + if (getItemProxyClass() != null) { - // provide m_row with primary key data of current row - getQueryObject().getClassDescriptor().getRowReader().readPkValuesFrom(getRsAndStmt().m_rs, getRow()); // assert: m_row is filled with primary key values from db return getProxyFromResultSet(); } else { - // 0. provide m_row with data of current row - getQueryObject().getClassDescriptor().getRowReader().readObjectArrayFrom(getRsAndStmt().m_rs, getRow()); - // assert: m_row is filled from db - // 1.read Identity Identity oid = getIdentityFromResultSet(); Object result = null; @@ -436,9 +434,11 @@ result = getCache().lookup(oid); if (result == null) { + + // map all field values from the current result set + getQueryObject().getClassDescriptor().getRowReader().readObjectArrayFrom(getRsAndStmt().m_rs, getRow()); // 3. If Object is not in cache - // materialize Object with primitive attributes filled from - // current row + // materialize Object with primitive attributes filled from current row result = getQueryObject().getClassDescriptor().getRowReader().readObjectFrom(getRow()); // result may still be null! if (result != null) @@ -464,7 +464,7 @@ * actual class. */ // fill reference and collection attributes - ClassDescriptor cld = getQueryObject().getClassDescriptor().getRepository().getDescriptorFor(result.getClass()); + ClassDescriptor cld = getBroker().getClassDescriptor(result.getClass()); // don't force loading of reference final boolean unforced = false; // Maps ReferenceDescriptors to HashSets of owners @@ -476,11 +476,13 @@ } else // Object is in cache { - ClassDescriptor cld = getQueryObject().getClassDescriptor().getRepository().getDescriptorFor(result.getClass()); - // if refresh is required, update the cache instance from the - // db + ClassDescriptor cld = getBroker().getClassDescriptor(result.getClass()); + // if refresh is required, read all values from the result set and + // update the cache instance from the db if (cld.isAlwaysRefresh()) { + // map all field values from the current result set + getQueryObject().getClassDescriptor().getRowReader().readObjectArrayFrom(getRsAndStmt().m_rs, getRow()); getQueryObject().getClassDescriptor().getRowReader().refreshObject(result, getRow()); } getBroker().refreshRelationships(result, cld); --------------------------------------------------------------------- To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org For additional commands, e-mail: ojb-dev-help@db.apache.org