ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ARAI Hiroyuki" <frontw...@gmail.com>
Subject Re: Question on using queryForObject(statementName, parameterObject, resultObject);
Date Sun, 29 Jul 2007 02:48:44 GMT
Hi, Warren

At first, you have to set resultClass/resultMap attribute in select element.

Then, when you want to use nested JavaBean(i.e. tax object in item),
you have to use ResultMap.

for example:

<resultMap id="itemMap" class="com.example.Item">
  <result property="tax.description" column="TAX_NAME" />

<select id="getItemTax" parameterClass="item" resultMap="itemMap">



2007/7/29, Warren <warren@clarksnutrition.com>:
>  I have an item object that has a tax object that has a description field
> I need to set. I want to use the item object as the parameter and the
> same object as the result.
> sqlMap.queryForObject("getTax", item, item);
> <select id="getItemTax" parameterClass="item">
>    SELECT TAX_Name AS tax.description FROM ...
> </select>
> It is the tax.description that is getting me in trouble. How do I write
> this or escape this? Or am I doing this completely wrong?
> --
> Thanks,
> Warren Bell

View raw message