You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by market sniffer <ma...@gmail.com> on 2008/04/21 10:44:40 UTC
ibatis 2.1.7 build #597 value object problem
hi:
i try to select from a table with no rows of data and uses the following
resultMap as return
<!-- definitions of another statement which has the following selection-->
....
<result property="mktTotalIncome" column="HDBH"
select="marketing.mktTotalIncome"/>
...
<select id="mktTotalIncome" parameterClass="java.lang.String"
resultMap="get-mktTotalIncome-result">
select
MARKETING_ID,
INCOME_TOTAL_AIM,
INCOME_TOTAL_ACTUAL,
BEFORE_ARPU_THREE,
BEFORE_ARPU_TWO,
BEFORE_ARPU_ONE,
AFTER_ARPU_ONE,
AFTER_ARPU_TWO,
AFTER_ARPU_THREE
from da.TABA_MARKET_TOTAL_INCOME
where MARKETING_ID = #marketingId#
</select>
<resultMap id="get-mktTotalIncome-result" class="MktTotalIncomeVO">
<result property="marketing_id" column="MARKETING_ID"/>
<result property="income_total_aim" column="INCOME_TOTAL_AIM"
nullValue="0"/>
<result property="income_total_actual" column="INCOME_TOTAL_ACTUAL"
nullValue="0"/>
<result property="before_arpu_three" column="BEFORE_ARPU_THREE"
nullValue="0"/>
<result property="before_arpu_two" column="BEFORE_ARPU_TWO"
nullValue="0"/>
<result property="before_arpu_one" column="BEFORE_ARPU_ONE"
nullValue="0"/>
<result property="after_arpu_one" column="AFTER_ARPU_ONE" nullValue="0"/>
<result property="after_arpu_two" column="AFTER_ARPU_TWO" nullValue="0"/>
<result property="after_arpu_three" column="AFTER_ARPU_THREE"
nullValue="0"/>
</resultMap>
since there is no data, i am expecting the the field "mktTotalIncome" to
return null, however i got the return of a MktTotalIncomeVO with its fields
set to null, and which in turn is causing some of the arithmatic problems.
i am wondering why it does not return NULL but a new object with fields set
to null?
thanks.
Re: ibatis 2.1.7 build #597 value object problem
Posted by market sniffer <ma...@gmail.com>.
thanks a lot!
2008/4/21, Clinton Begin <cl...@gmail.com>:
>
> Two solutions to this one:
>
> 1) Turn lazy loading off
>
> 2) Use a join mapping (which will be faster anyway) << preferred.
>
> This is a known limitation of the lazy loader, but something we could
> probably fix too.
>
> Clinton
>
> On Mon, Apr 21, 2008 at 2:44 AM, market sniffer <ma...@gmail.com>
> wrote:
>
> > hi:
> >
> > i try to select from a table with no rows of data and uses the following
> > resultMap as return
> >
> > <!-- definitions of another statement which has the following
> > selection-->
> > ....
> > <result property="mktTotalIncome" column="HDBH"
> > select="marketing.mktTotalIncome"/>
> > ...
> >
> > <select id="mktTotalIncome" parameterClass="java.lang.String"
> > resultMap="get-mktTotalIncome-result">
> > select
> > MARKETING_ID,
> > INCOME_TOTAL_AIM,
> > INCOME_TOTAL_ACTUAL,
> > BEFORE_ARPU_THREE,
> > BEFORE_ARPU_TWO,
> > BEFORE_ARPU_ONE,
> > AFTER_ARPU_ONE,
> > AFTER_ARPU_TWO,
> > AFTER_ARPU_THREE
> > from da.TABA_MARKET_TOTAL_INCOME
> > where MARKETING_ID = #marketingId#
> > </select>
> >
> > <resultMap id="get-mktTotalIncome-result" class="MktTotalIncomeVO">
> > <result property="marketing_id" column="MARKETING_ID"/>
> > <result property="income_total_aim" column="INCOME_TOTAL_AIM"
> > nullValue="0"/>
> > <result property="income_total_actual" column="INCOME_TOTAL_ACTUAL"
> > nullValue="0"/>
> > <result property="before_arpu_three" column="BEFORE_ARPU_THREE"
> > nullValue="0"/>
> > <result property="before_arpu_two" column="BEFORE_ARPU_TWO"
> > nullValue="0"/>
> > <result property="before_arpu_one" column="BEFORE_ARPU_ONE"
> > nullValue="0"/>
> > <result property="after_arpu_one" column="AFTER_ARPU_ONE"
> > nullValue="0"/>
> > <result property="after_arpu_two" column="AFTER_ARPU_TWO"
> > nullValue="0"/>
> > <result property="after_arpu_three" column="AFTER_ARPU_THREE"
> > nullValue="0"/>
> > </resultMap>
> >
> > since there is no data, i am expecting the the field "mktTotalIncome" to
> > return null, however i got the return of a MktTotalIncomeVO with its fields
> > set to null, and which in turn is causing some of the arithmatic problems.
> >
> > i am wondering why it does not return NULL but a new object with fields
> > set to null?
> >
> > thanks.
> >
>
>
Re: ibatis 2.1.7 build #597 value object problem
Posted by Clinton Begin <cl...@gmail.com>.
Two solutions to this one:
1) Turn lazy loading off
2) Use a join mapping (which will be faster anyway) << preferred.
This is a known limitation of the lazy loader, but something we could
probably fix too.
Clinton
On Mon, Apr 21, 2008 at 2:44 AM, market sniffer <ma...@gmail.com>
wrote:
> hi:
>
> i try to select from a table with no rows of data and uses the following
> resultMap as return
>
> <!-- definitions of another statement which has the following selection-->
> ....
> <result property="mktTotalIncome" column="HDBH"
> select="marketing.mktTotalIncome"/>
> ...
>
> <select id="mktTotalIncome" parameterClass="java.lang.String"
> resultMap="get-mktTotalIncome-result">
> select
> MARKETING_ID,
> INCOME_TOTAL_AIM,
> INCOME_TOTAL_ACTUAL,
> BEFORE_ARPU_THREE,
> BEFORE_ARPU_TWO,
> BEFORE_ARPU_ONE,
> AFTER_ARPU_ONE,
> AFTER_ARPU_TWO,
> AFTER_ARPU_THREE
> from da.TABA_MARKET_TOTAL_INCOME
> where MARKETING_ID = #marketingId#
> </select>
>
> <resultMap id="get-mktTotalIncome-result" class="MktTotalIncomeVO">
> <result property="marketing_id" column="MARKETING_ID"/>
> <result property="income_total_aim" column="INCOME_TOTAL_AIM"
> nullValue="0"/>
> <result property="income_total_actual" column="INCOME_TOTAL_ACTUAL"
> nullValue="0"/>
> <result property="before_arpu_three" column="BEFORE_ARPU_THREE"
> nullValue="0"/>
> <result property="before_arpu_two" column="BEFORE_ARPU_TWO"
> nullValue="0"/>
> <result property="before_arpu_one" column="BEFORE_ARPU_ONE"
> nullValue="0"/>
> <result property="after_arpu_one" column="AFTER_ARPU_ONE"
> nullValue="0"/>
> <result property="after_arpu_two" column="AFTER_ARPU_TWO"
> nullValue="0"/>
> <result property="after_arpu_three" column="AFTER_ARPU_THREE"
> nullValue="0"/>
> </resultMap>
>
> since there is no data, i am expecting the the field "mktTotalIncome" to
> return null, however i got the return of a MktTotalIncomeVO with its fields
> set to null, and which in turn is causing some of the arithmatic problems.
>
> i am wondering why it does not return NULL but a new object with fields
> set to null?
>
> thanks.
>