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 Jane Phillips <ja...@yahoo.com> on 2007/07/17 19:46:18 UTC

Help needed to retrieve result class has ArrayList in its attributes.

Hello,
   
  I need help to retrieve a query which one ID(product) assoicated many other info(client names etc). The lay out as followings:
   
  table 1 : products 
  column 1) productID 
  column 2) name 
  column 3) desc
   
  table 2: product_Client. in this table one product ID can have multiple clientnames.
  column 1) productID
  column 2) clientname
   
  java: ProductOBJ
  String productID;
  String name;
  String desc
  ArrayList clientname;
   
  <sqlMap>
  <select id="getProducts" parameterClass="java.lang.String" resultClass="ProductOBJ">
  select a.productID, a.name,b.clientname
  from products a, product_client b
  where a.productID = b.productID
  and a.productID=xxx
  </select>
  </sqlMap>
   
  I would like to have query return me as one ProductOBJ has many client name(String). I am using ProductOBJ aProduct = (ProductOBJ)queryForObject("getProducts", productID)
   
  Thanks so much,

 
---------------------------------
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

Re: Help needed to retrieve result class has ArrayList in its attributes.

Posted by Nathan Maves <na...@gmail.com>.
I think you are looking for the complex properties functionality on
page 36 of the developers manual.

Nathan



On 7/17/07, Jane Phillips <ja...@yahoo.com> wrote:
> Hello,
>
> I need help to retrieve a query which one ID(product) assoicated many other
> info(client names etc). The lay out as followings:
>
> table 1 : products
> column 1) productID
> column 2) name
> column 3) desc
>
> table 2: product_Client. in this table one product ID can have multiple
> clientnames.
> column 1) productID
> column 2) clientname
>
> java: ProductOBJ
> String productID;
> String name;
> String desc
> ArrayList clientname;
>
> <sqlMap>
> <select id="getProducts" parameterClass="java.lang.String"
> resultClass="ProductOBJ">
> select a.productID, a.name,b.clientname
> from products a, product_client b
> where a.productID = b.productID
> and a.productID=xxx
> </select>
> </sqlMap>
>
> I would like to have query return me as one ProductOBJ has many client
> name(String). I am using ProductOBJ aProduct =
> (ProductOBJ)queryForObject("getProducts", productID)
>
> Thanks so much,
>
>  ________________________________
> Sucker-punch spam with award-winning protection.
>  Try the free Yahoo! Mail Beta.
>
>