[jira] Commented: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

2007-06-26 Thread dyna bean (JIRA)

[ 
https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508330
 ] 

dyna bean commented on BEANUTILS-142:
-

Hello Niall Pemberton,

opps, yes you have right ,thanks. 

I have my project tested again with the new night version (20070626), same 
exception :

 org.apache.commons.beanutils.ConversionException: Cannot assign value of type 
'java.sql.Date' to property 'stand' of type 'java.sql.Timestamp'
at 
org.apache.commons.beanutils.BasicDynaBean.set(BasicDynaBean.java:297)
at 
org.apache.commons.beanutils.RowSetDynaClass.copy(RowSetDynaClass.java:240)
at 
org.apache.commons.beanutils.RowSetDynaClass.init(RowSetDynaClass.java:187)
at 
org.apache.commons.beanutils.RowSetDynaClass.init(RowSetDynaClass.java:105)

I think, it is fixed with one change line in class RowSetDynaClass, it work at 
least.

protected void copy(ResultSet resultSet) throws SQLException {
...
  Class type = properties[i].getType(); //Old : 
properties[i].getClass()
   ...
}

 [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 
 10g JDBC driver
 --

 Key: BEANUTILS-142
 URL: https://issues.apache.org/jira/browse/BEANUTILS-142
 Project: Commons BeanUtils
  Issue Type: Bug
  Components: DynaBean
 Environment: Operating System: Windows XP
 Platform: All
Reporter: Li Zhang
 Fix For: 1.8.0

 Attachments: Beanutils-142.patch


 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Updated: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

2007-06-26 Thread dyna bean (JIRA)

 [ 
https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

dyna bean updated BEANUTILS-142:


Comment: was deleted

 [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 
 10g JDBC driver
 --

 Key: BEANUTILS-142
 URL: https://issues.apache.org/jira/browse/BEANUTILS-142
 Project: Commons BeanUtils
  Issue Type: Bug
  Components: DynaBean
 Environment: Operating System: Windows XP
 Platform: All
Reporter: Li Zhang
 Fix For: 1.8.0

 Attachments: Beanutils-142.patch


 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



[jira] Commented: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver

2007-06-21 Thread dyna bean (JIRA)

[ 
https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506944
 ] 

dyna bean commented on BEANUTILS-142:
-

Unfortunately, this patch not working in my project.

Got the resources  from nightly build (20070621) ( 
http://people.apache.org/builds/jakarta-commons/nightly/commons-beanutils/ )

and change the method  public Object convert(Class type, Object value) in class 
SqlTimestampConverter. its work ;)


public Object convert(Class type, Object value) {

if (value == null) {
if (useDefault) {
return (defaultValue);
} else {
throw new ConversionException(No value specified);
}
}

if (value instanceof Timestamp) {
return (value);
}
else if (value instanceof Date) {
return (new Timestamp(((Date)value).getTime()));
}

try {
return (Timestamp.valueOf(value.toString()));
} catch (Exception e) {
if (useDefault) {
return (defaultValue);
} else {
throw new ConversionException(e);
}
}

}

 [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 
 10g JDBC driver
 --

 Key: BEANUTILS-142
 URL: https://issues.apache.org/jira/browse/BEANUTILS-142
 Project: Commons BeanUtils
  Issue Type: Bug
  Components: DynaBean
 Environment: Operating System: Windows XP
 Platform: All
Reporter: Li Zhang
 Fix For: 1.8.0

 Attachments: Beanutils-142.patch


 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]