|
|
Hi all. I am currently converting an ibatis code to mybatis and I am
using the MapperFactoryBean on mybatis.
I have a custom type handler called CurrencyAmountTypeHandler. The
handler simply set and get a BigDecimal. I defined it in the config
xml as:
<typeHandler javaType="my.package.CurrencyAmount"
handler="my.other.package.CurrencyAmountTypeHandler" />
Then in one of my mapper, I have this:
<resultMap id="currencyAmountMap" type="my.package.CurrencyAmount">
<result property="amount" column="amount"
javaType="java.math.BigDecimal"/>
<result property="exchangeRateUsd" column="exchange_rate_usd"
javaType="double"/>
<association property="currency" select="getCurrencyByCode"
column="budget_currency"/>
</resultMap>
The query looks like this:
<select id="getContribTotals" parameterType="map"
resultMap="currencyAmountMap">
SELECT NVL(SUM(I.TOTAL_AMOUNT), 0) as amount,
'USD' as budget_currency,
1.0 as exchange_rate_usd
FROM ...
</select>
After executing the query, I noticed that it is going to the
CurrencyAmountTypeHandler. Maybe because I have a
type="my.package.CurrencyAmount" in the resultMap?
Is there a way not to execute the CurrencyAmountTypeHandler using the
above configurations?
Thanks.
Mike
|