[jira] Commented: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512504 ] Niall Pemberton commented on BEANUTILS-142: --- I've added a test case which uses a proxy ResultSetMetaData impl. which returns the wrong class name (i.e. java.sql.Timestamp instead of java.sql.Date) and everything works fine for me. I can only get the ConversionException: Cannot assign value... issue you do when I remove my change to RowSetDynaClass which calls ConvertUtils. So the only explanation I have ATM is that you're using a version of bean utils prior to that change? Also looking at your test results above - there seems to be two issues? 1) Oracles driver is incorrectly returning java.sql.Timestamp as the column class name for date columns (should be java.sql.Date) 2) Oracles driver is incorrectly returning oracle.sql.TIMESTAMP as the column class name for timestamp columns (should be java.sql.Timestamp); So even if my ConvertUtils fix works to stop issue #1 from causing an exception - the end result (java.sql.Timestamp values instead of java.sql.Date in the DynaBean) still seems wrong to me. And for issue #2 we don't have a solution. I would be interested to know what the ResultSetMetaData's getColumnType(idx) returned for the above - since if they return java.sql.Types.DATE and java.sql.Types.TIMESTAMP correctly then we could use that as the basis for a solution? [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 Assignee: Henri Yandell Fix For: 1.8.0 Attachments: Beanutils-142.patch, Play.java 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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512666 ] Henri Yandell commented on BEANUTILS-142: - Definitely two issues. On your fix; it turns out that I was running the new code, but it was not executing it. I didn't have commons-logging in the classpath, and the catch(Throwable t) { } was hiding that. Is there any reason for that try/catch? Can we remove it? On 1) This is a tricky one. Oracle's DATE type can contain both date and time parts. Its TIMESTAMP type lets you get down to milliseconds (and to smaller units than JDBC types usually handle). So DATE - java.sql.Timestamp is completely correct from a mapping point of view. I think there's nothing more to do here - people have to know about the database they're dealing with to use DynaBeans. 2) Obvious solutions to this are: i) Fix JDBC driver. Could start another project to make a 'fix the stinking oracle jdbc driver via a wrapper'. Have always had an urge to do that :) ii) Convert the oracle.sql.TIMESTAMP to a java.sql.Timestamp. The problem here is that this means a) changing JDBCDynaClass so that createDynaProperty silently converts oracle.sql.TIMESTAMP to java.sql.Timestamp; and secondly, that we then have a converter in place to do oracle.sql.TIMESTAMP to java.sql.Timestamp. The problem with that last step is that our converter is Class based and not String based. Still *playing with that idea* [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 Assignee: Henri Yandell Fix For: 1.8.0 Attachments: beanutils-142-oracle-bug.patch, Beanutils-142.patch, Play.java 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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12512669 ] Henri Yandell commented on BEANUTILS-142: - As we dig into it at the same time :) So... 3) Use Niall's patch. This is a bit odd in that it means that the DATE column type will goto a java.sql.Date and lose the time part [which may be all that is there given that Oracle lacks a TIME type]. Their metadata getColumnClassName says java.sql.Timestamp, the getColumnType says java.sql.Types.DATE, and the getObject returns java.sql.Date. So I think that's 2 to 1 in favour of saying that in Oracle you lose such things. So I'm +1 to your patch Niall. It removes the try throwable bit, so that can be ignored from my previous comment. [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 Assignee: Henri Yandell Fix For: 1.8.0 Attachments: beanutils-142-oracle-bug.patch, Beanutils-142.patch, Play.java 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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508623 ] Niall Pemberton commented on BEANUTILS-142: --- Thanks for spotting this - I've corrected this so should be available in the next (20060728) nightly build [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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12508634 ] Niall Pemberton commented on BEANUTILS-142: --- OK I don't have strong opnions on this issue - in the absence of other opnions I'll leave the change I committed accidently in. If anyone thinks that it should be removed then I don't have a problem with that either. Either way (or alternative solutions) I'd like to get to a point where we can close this. P.S. dyna bean - please don't delete previous comments you made - it makes the thread of comment confusing [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
[ 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] Commented: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver
[ 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]
[jira] Commented: (BEANUTILS-142) [beanutils] RowSetDynaClass fails to copy resulset to DynaBean with Oracle 10g JDBC driver
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12506996 ] Niall Pemberton commented on BEANUTILS-142: --- To be honest I find your comment pretty confusing - SqlTimestampConverter has been changed alot in the nightly build - it no longer has a convert() method - instead now inherits from the generic DateTimeConverter implementation - which from looking at your code does pretty similar processing. Are you sure you're using the nightly build? Saying Unfortunately, this patch not working in my project doesn't actually tell us alot- explict details of what not working means (including any stack trace, if any) would be very useful. Even better a test case demonstrating the problem would be great. Otherwise its alomost impossible to do anything. [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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500254 ] Henri Yandell commented on BEANUTILS-142: - The RowSetDynaClass change still uses getObject, which on Oracle will return oracle.sql.Timestamp which extends Object. So unless the convert lookup handles oracle.sql.Timestamp as a String, it's not going to work and people will have to register their own workaround converter (which we could put on a wiki or something). [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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500267 ] Niall Pemberton commented on BEANUTILS-142: --- OK I didn't read carefully enough - the initial description seemed to indicate it was an issue between java.sql.Date and java.sql.Timestamp - I'd missed the point about oracle.sql.TIMESTAMP altogether. I'll revert the change I made (which was accidental anyway). [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
[ https://issues.apache.org/jira/browse/BEANUTILS-142?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12497658 ] Niall Pemberton commented on BEANUTILS-142: --- Accicentally comitted the patch as part of r540385 - I'll leave it in for now - can always be reverted later http://svn.apache.org/viewvc?view=revrevision=540385 [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]