You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Tim Dudgeon <tj...@informaticsmatters.com> on 2004/10/26 12:46:03 UTC
[BeanUtils, SQL] Controlling mappings of sql to java types
Hi,
I've been using ResultSetDynaClass and RowSetDynaClass for a bit, and
find these very handy. I've also looked ino the things in the SQL
project as a lightweight. persistence layer. Both of these look very
useful for my purpose as I need to obtain access to the ResultSet on a
row-by-row basis.
I'd like to be able to control the Java type of the values that are
obtained from these DynaBeans. From what I can gather there is a default
mapping of the sql type to a Java class, so that when you call
Object o = dynaBean.get("myProperty");
the class of the object returned is predetermined based, presumably, on
some default mapping from the SQL type to the Java type.
Is there any way of changing this on a column-by-column basis. e.g. I
might have two number columns in my ResultSet, and I want one to be a
Float, the other a Double so that I could say
Double d = (Double)dynaBean.get("col1");
Float f = (Float)dynaBean.get("col2");
Thanks
Tim
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org