commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catoe, Shawn" <sca...@ercot.com>
Subject DbUtils - OracleRowProcessor object
Date Wed, 14 Apr 2004 18:45:37 GMT
I work for a medium sized company in Texas.  We use Oracle databases and
DbUtils.  We ran into several issues with Oracle databases.
The first issue is that Oracle NUMBER comes back through the JDBC driver
as java.math.BigDecimal.  Therefore, sets of numeric primitives in
objects will fail to set.  An OracleRowProcessor was written to
accommodate this fact.  The basis of it is this:
If it fails to find a compatible method and the value is a BigDecimal,
the code will then determine the numeric type of the parameter and
invoke the method using the BigDecimal methods to pass that parameter
type into the invoker.
The second issue, which seems could be used in all row processors, was
trying to set a method with an Object other than that methods member
type.  The issue arose when we were trying to set a boolean primitive
with a "true"/"false" String.  (Boolean.getBoolean(java.lang.String))
The BasicRowProcessor determines that the String type is not of the
Boolean type and therefore will not set the member in the Object.  In
the OracleRowProcessor submitted, it will attempt to invoke on a method
from the target that matches that method name and value class.  To say
clearly, it will look for a method called setBoolean(String bool) to
invoke.  This functionality might be useful in all RowProcessor
implementations.

The file <OracleRowProcessor.java> is attached.



Thank You,
Shawn Catoe

Free thinkers are dangerous.


Mime
View raw message