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
Date Tue, 14 Jun 2005 13:28:12 GMT
arminw      2005/06/14 06:28:12

  Modified:    src/java/org/apache/ojb/broker/accesslayer Tag:
                        OJB_1_0_RELEASE RowReaderDefaultImpl.java
  Log:
  make sure that each column from the result set was read only once. fix problem with discriminator
column, this column was read twice in old versions
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.30.2.4  +10 -5     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.2.3
  retrieving revision 1.30.2.4
  diff -u -r1.30.2.3 -r1.30.2.4
  --- RowReaderDefaultImpl.java	7 May 2005 16:43:05 -0000	1.30.2.3
  +++ RowReaderDefaultImpl.java	14 Jun 2005 13:28:12 -0000	1.30.2.4
  @@ -177,7 +177,7 @@
           }
           else
           {
  -            String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs);
  +            String ojbConcreteClass = extractOjbConcreteClass(m_cld, rs, row);
               /*
               arminw:
               if multiple classes were mapped to the same table, lookup the concrete
  @@ -237,7 +237,7 @@
           }
       }
   
  -    protected String extractOjbConcreteClass(ClassDescriptor cld, ResultSet rs)
  +    protected String extractOjbConcreteClass(ClassDescriptor cld, ResultSet rs, Map row)
       {
           FieldDescriptor fld = m_cld.getOjbConcreteClassField();
           if (fld == null)
  @@ -247,7 +247,8 @@
           try
           {
               String result = (String) fld.getJdbcType().getObjectFromColumn(rs, fld.getColumnName());
  -            if (result == null || result.trim().length() == 0)
  +            result = result != null ? result.trim() : null;
  +            if (result == null || result.length() == 0)
               {
                   throw new PersistenceBrokerException(
                           "ojbConcreteClass field for class " + cld.getClassNameOfObject()
  @@ -255,7 +256,11 @@
               }
               else
               {
  -                return result.trim();
  +                /*
  +                arminw: Make sure that we don't read discriminator field twice from the
ResultSet.
  +                */
  +                row.put(fld.getColumnName(), result);
  +                return result;
               }
           }
           catch(SQLException e)
  
  
  

---------------------------------------------------------------------
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