You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Guilhem Berthalon <gu...@aroban.com> on 2007/03/06 13:51:41 UTC

Recursive list

Hi,
I ‘ve got a problem to populate recursive list :

This my resultmap :

       <resultMap id="ResultCategorie" class="Categorie" groupBy="ParentId">
      <constructor>
        <argument argumentName="intituleXML" column="CategorieIntitule"/>
      </constructor>
      <result property="Id" column="CategorieId"/>
      <result property="ParentId" column="CategorieParentId"/>
      <result property="Abreviation" column="CategorieAbreviation"/>
      <result property="Ordre" column="CategorieOrdre"/>
      <result property="Obsolete" column="CategorieObsolete"/>
      <result property="DateCreation" column="CategorieDateCreation"/>
      <result property="TimeStamp" column="CategorieTimeStamp"/>
      <result property="CategorieList" nullValue="null"
resultMapping="Categorie.ResultCategorie"
notNullColumn="CategorieParentId"/>
    </resultMap>

The content of my categorie table and the result of my stored procedure
(selectCategorie):

ID	ParentID	Intitule		Abreviation

11	NULL		Autheur 		Aut
13	NULL		Bahut			ba
9	7		Collection2006  	Col2006
10	7		Collection2007  	Col2007
7	NULL		Collection		Coll

Have you got an idea ?
Thanks,

 

Guilhem Berthalon
AROBAN
28 rue des teinturiers
84 000 AVIGNON
tel : 04 32 76 23 60
Hotline : 04 90 85 89 29
 


Re: Recursive list

Posted by Bob Hanson <mn...@gmail.com>.
1. GroupBy result maps do not currently support the <constructor>
element. It is ignored.
2. I recently learned from Giles that the same ResultMap cannot be
used more than once when processing a query so I don't believe you can
achieve what you're trying to do below.

On 3/6/07, Guilhem Berthalon <gu...@aroban.com> wrote:
> Hi,
> I 've got a problem to populate recursive list :
>
> This my resultmap :
>
>        <resultMap id="ResultCategorie" class="Categorie" groupBy="ParentId">
>       <constructor>
>         <argument argumentName="intituleXML" column="CategorieIntitule"/>
>       </constructor>
>       <result property="Id" column="CategorieId"/>
>       <result property="ParentId" column="CategorieParentId"/>
>       <result property="Abreviation" column="CategorieAbreviation"/>
>       <result property="Ordre" column="CategorieOrdre"/>
>       <result property="Obsolete" column="CategorieObsolete"/>
>       <result property="DateCreation" column="CategorieDateCreation"/>
>       <result property="TimeStamp" column="CategorieTimeStamp"/>
>       <result property="CategorieList" nullValue="null"
> resultMapping="Categorie.ResultCategorie"
> notNullColumn="CategorieParentId"/>
>     </resultMap>
>
> The content of my categorie table and the result of my stored procedure
> (selectCategorie):
>
> ID      ParentID        Intitule                Abreviation
>
> 11      NULL            Autheur                 Aut
> 13      NULL            Bahut                   ba
> 9       7               Collection2006          Col2006
> 10      7               Collection2007          Col2007
> 7       NULL            Collection              Coll
>
> Have you got an idea?
> Thanks,
>
>
>
> Guilhem Berthalon
> AROBAN
> 28 rue des teinturiers
> 84 000 AVIGNON
> tel : 04 32 76 23 60
> Hotline : 04 90 85 89 29
>
>
>