commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver
Date Mon, 24 Apr 2006 15:29:55 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=39343>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=39343





------- Additional Comments From li.zhang@aeso.ca  2006-04-24 15:29 -------
You are absolutely right. It is not a bug in RowSetDynaClass. It should be an
enhancement to work around Oracle 10g JDBC driver bug. Below is how I work
around the Oracle 10g JDBC driver bug:

  public class Oracle10gRowSetDynaClass extends RowSetDynaClass {
    private static final long serialVersionUID = -1976492272319522504L;

    public Oracle10gRowSetDynaClass(ResultSet rs) throws SQLException {
      super(rs);
    }
  
    protected void copy(ResultSet resultSet) throws SQLException {
      while (resultSet.next()) {
        DynaBean bean = new BasicDynaBean(this);
        for (int i = 0; i < properties.length; i++) {
          String name = properties[i].getName();
          Object value = null;
          if (properties[i].getType().equals(Timestamp.class)) {
            value = resultSet.getTimestamp(name);
          } else {
            value = resultSet.getObject(name);
          }
          bean.set(name, value);
        }
        rows.add(bean);
      }
    }
  }


(In reply to comment #1)
> So, to make sure I'm understanding things, the Oracle 10g bug is that
ResultSet.getObject
> (name).getClass() returns java.sql.Date and not java.sql.Timestamp?  Rather
than it being a bug in the 
> ResultSetMetaData return?
> 
> I presume the Exception being thrown is the "ConversionException - Cannot
assign value of type " one. 
> So to get around that you would need to:
> 
> a) Extend BasicDynaBean and override the set(String name, Object value)
method, such that it converts 
> the sql.Date to a sql.Timestamp when the Object value is a Date and the
DynaProperty.getType is 
> Timestamp.
> b) Extend RowSetDynaClass to create the new BasicDynaBean extension
> 
> I presume that even though the ResultSet.getObject(name).getClass() is
returning java.sql.Date, it really 
> is an oracle.sql.TIMESTAMP and it does contain the time information?



-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

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


Mime
View raw message