You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Catoe, Shawn" <sc...@ercot.com> on 2004/04/14 20:45:37 UTC

DbUtils - OracleRowProcessor object

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.


Re: DbUtils - OracleRowProcessor object

Posted by David Graham <gr...@yahoo.com>.
The DbUtils nightly builds include a more intelligent bean property to
column matching implementation.  Both of your issues should be fixed in
the nightlies.

David

--- "Catoe, Shawn" <sc...@ercot.com> wrote:
> 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.
> 
> > ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org



	
		
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org