db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/broker/accesslayer RowReaderDefaultImpl.java RsIterator.java
Date Mon, 09 Aug 2004 07:45:42 GMT
arminw      2004/08/09 00:45:42

  Modified:    src/java/org/apache/ojb/broker/accesslayer
                        RowReaderDefaultImpl.java RsIterator.java
  Log:
  clear used row Map for each object, default RowReader now only add fields
  if they not already set in row map. 
  
  apply patch by Charles Anthony:
  We've got a problem with the RowReaderDefaultImpl on some of our tables,
  which arises when we use the Microsoft SqlServer Driver and the table
  includes a LONGVARCHAR (or LONGVARBINARY).
  The MS Driver doesn't like the columns resultset being read twice (or out of
  sequence) when the data include an IMAGE or TEXT column.
  
  The reason it throws this error is because the Default row reader first
  reads the PK to check the cache, and then if nothing is found, reads the
  entire row, thus leading to columns being read twice.
  
  So, I'm writing a custom HPDRowReader that reads all the columns into the
  map in one go - and that only adds something to row map if the column is't
  already in the map.
  
  Revision  Changes    Path
  1.31      +6 -3      db-ojb/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java
  
  Index: RowReaderDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/accesslayer/RowReaderDefaultImpl.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- RowReaderDefaultImpl.java	6 May 2004 18:54:44 -0000	1.30
  +++ RowReaderDefaultImpl.java	9 Aug 2004 07:45:41 -0000	1.31
  @@ -196,8 +196,11 @@
               for (int j = 0; j < size; j++)
               {
                   fld = fields[j];
  -                val = fld.getJdbcType().getObjectFromColumn(rs, fld.getColumnName());
  -                row.put(fld.getColumnName(), fld.getFieldConversion().sqlToJava(val));
  +                if(!row.containsKey(fld.getColumnName()))
  +                {
  +                    val = fld.getJdbcType().getObjectFromColumn(rs, fld.getColumnName());
  +                    row.put(fld.getColumnName(), fld.getFieldConversion().sqlToJava(val));
  +                }
               }
           }
           catch (SQLException t)
  
  
  
  1.66      +2 -1      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.65
  retrieving revision 1.66
  diff -u -r1.65 -r1.66
  --- RsIterator.java	25 Jul 2004 00:18:50 -0000	1.65
  +++ RsIterator.java	9 Aug 2004 07:45:41 -0000	1.66
  @@ -405,6 +405,7 @@
        */
       protected Object getObjectFromResultSet() throws PersistenceBrokerException
       {
  +        getRow().clear();
           /**
            * MBAIRD if a proxy is to be used, return a proxy instance and dont
            * perfom a full materialization. NOTE: Potential problem here with
  
  
  

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


Mime
View raw message