You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2006/04/19 00:43:34 UTC

DO NOT REPLY [Bug 39343] New: - RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

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

           Summary: RowSetDynaClass fails to copy resulset to DynaBean with
                    Oracle 10g JDBC driver
           Product: Commons
           Version: unspecified
          Platform: All
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Bean Utilities
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: cybertriton@gmail.com


Beginning in Oracle 9.2, DATE is mapped to Date and TIMESTAMP is mapped to
Timestamp. However if you were relying on DATE values to contain time
information, there is a problem. When using Oracle 10g JDBC driver, the
ResultSetMetaData.getColumnClassName returns java.sql.Timestamp but
ResultSet.getObject(name).getClass() returns java.sql.Date. Obviously these two
do not match each other. When the RowSetDynaClass.copy function tries to set the
value to BasicDynaBean, it throws exception. Need a workaround.

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


DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

Posted by bu...@apache.org.
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 bayard@apache.org  2006-09-08 23:02 -------
Jira issue is: https://issues.apache.org/jira/browse/BEANUTILS-142

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


DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

Posted by bu...@apache.org.
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


bayard@apache.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|RowSetDynaClass fails to    |[beanutils] RowSetDynaClass
                   |copy resulset to DynaBean   |fails to copy resulset to
                   |with Oracle 10g JDBC driver |DynaBean with Oracle 10g
                   |                            |JDBC driver




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


DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

Posted by bu...@apache.org.
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 bayard@apache.org  2006-04-24 17:30 -------
For a fix for beanutils, I'd be more tempted to check if the object coming out of the result set is an 
instance of oracle.sql.TIMESTAMP (well, if the class.getName() equalled that) so that it doesn't happen for 
other JDBC drivers - would hate for this fix to create a bug elsewhere.

Otherwise though, that's exactly the work around I was envisaging :) Thanks for posting it back.

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


DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

Posted by bu...@apache.org.
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 bayard@apache.org  2006-04-21 21:40 -------
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


DO NOT REPLY [Bug 39343] - [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

Posted by bu...@apache.org.
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