commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Keith Cheng <>
Subject unable to call setter(int) with query to Oracle
Date Wed, 07 Jan 2004 09:49:20 GMT
Hi all,

I have a Bean that has an "int" field and has the corresponding setter, looks
like this:

setMemberId(int theId)

And I have a sql to my Oracle like this:

select memberid from member where email=''

The "setMemberId()" is never get call.  Then I look at the source of DbUtils
and find that the "memberid" field returned by Oracle is not Integer, it is
java.math.BigDecimal and the codes in BasicRowProcessor won't let it through
since the "isCompatibleType()" returns fail with this "BigDecimal" value.

What I do now is that I edit the source and check whether the field is
BigDecimal and try to convert to correct primary wrapper type such as Ineger,
Long and so on.  Any quick and easy work around?  

For long term, how about added a "hook function" (a public method that can be
overrided) and call it in createBean to get the value from ResultSet like this:

Object value = getValue(rs.getValue(), propType);

Some covertion logic can be in getValue() that convet the data type?


-- Keith Cheng

Shining Friends、好心好報、歲月如歌...
浪漫鈴聲  情心連繫

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

View raw message