commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Grégory Joseph <>
Subject [beanutils] Issue with RowSetDynaClass and oracle10g drivers...
Date Tue, 14 Jun 2005 13:20:08 GMT
Hi list,

What I'm going to point out here is obviously an oracle issue, but I'd
like to see if someone's got a sensible workaround or solution to
this, considering I'm using beanutils' RowSetDynaClass.
I've got this piece of code (deliberately skipping imports and
exception handling for the purpose of readability here)
            Connection conn = DriverManager.getConnection(url, user, pass);
            String query = " SELECT some_date_field AS foo FROM
some_table WHERE id=?";
            PreparedStatement stmt = conn.prepareStatement(query);
            stmt.setString(1, "T32000171");
            rs = stmt.executeQuery();
            RowSetDynaClass result = new RowSetDynaClass(rs);

When I run this with oracle10g and latest drivers (ojdbc14 version I believe), I get
org.apache.commons.beanutils.ConversionException: Cannot assign value of
type 'java.sql.Date' to property 'foo' of type 'java.sql.Timestamp'

If you need explanations, do this:
            System.out.println("from resultset : " +
            System.out.println("from metadata : " +

As you'd see if you'd try this out, the metadata says the column is of
type java.sql.Timestamp, while the resultset says it's a java.sql.Date

Seems oracle guys think that because that behaviour is documented, it
is fine:

Would a Converter help us, maybe?

We've also tried using functions like to_timestamp in the queries, but
that only makes things worse because, while the returned type is at
least consistent between resultset and metadata, it returns objects of
type oracle.TIMESTAMP which are just plainly oracle specific classes,
not implementations or subclasses of any java.sql types...

Any hint or info appreciated ! Thanks,


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message