I belive the issue is that your setter isn't quite right.  Should be like
this:

public void setAtrib_ (ArrayList<Atrib> atrib_) {this.atrib_ = atrib_;}

If you do it this way, iBATIS will know to expect multiple values for the
attributes.

Jeff Butler




On 7/19/07, Francisco Exposito Aguilera <[EMAIL PROTECTED]> wrote:

Hello,

I have another typical issue of a beginner!!!!!

I have two tables:

ELEM: id, name, atrib_id
ATRIB: id, name, value

In Elem java class I´ve defined

private ArrayList<Atrib> atrib_ = new ArrayList<Atrib>();
public void setAtrib_ (Atrib atrib) {atrib_.add(atrib);}

and in sqlMap I´ve defined:

<resultMap id="mapAtributos" class="atributo">
       <result property="id" column="ID"/>
       <result property="name" column="NAME"/>
       <result property="value" column="VALUE"/>
</resultMap>

<resultMap id="mapElementos" class="elemento">
       <result property="id" column="ID"/>
       <result property="name" column="NAME"/>
       <result property="atrib_id" column="ATRIB_ID" select="getAtributos"
/>
</resultMap>

<select id="getElementosTransaccion" resultMap="mapElementos">
       select * from ELEM where ATRIB_ID=#value#
</select>

<select id="getAtributos" resultMap="mapAtributos">
       select * from ATRIB oat_oet_id=#oet_id#
</select>

All this works properly if I have only one attribute for every element,
but
if there are two attribute for any element, the I obtain the error:

Cause: java.sql.SQLException: Error: executeQueryForObject returned too
many
results.

I understand the error, but I am not able to find the solution!!! How
could
I solve it? Thanks




Reply via email to