Tim

Can you also post the piece of Java code you're using to retrieve the results?
Do you use executeQueryForList()?

Regards,
Sven

Chen, Tim wrote:

Try this wiki post and see if it helps clear some stuff up

http://opensource2.atlassian.com/confluence/oss/display/IBATIS/How+do+I+
get+around+the+N+Plus+1+selects+problem
-----Original Message-----
From: Tony Qian [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 11, 2006 1:32 PM
To: [email protected]
Subject: grougBy issue

All,

I know this has been posted before. I have read a number of archived
emails regarding this issue and also the example by Clinton. I just
cannot make it work. The property parameters is always null. (btw, i
made it work using sub-select strategy). I just want to improve the
performance. Here is my mapping:

<resultMap id="select-sessionCommon" class="sessionCommon" groupBy="brandId">
     <result property="brandId" column="brand_id" />
     <result property="parameters" resultMap="CommonSession.elementMap"
/>
  </resultMap>

  <resultMap id="elementMap" class="element">
     <result property="value" column="paramete_value" />
     <result property="parameter"
resultMap="CommonSession.parameterMap" />
  </resultMap>

  <resultMap id="parameterMap" class="parameter" >
     <result property="parameterId" column="parameter_id" />
     <result property="name" column="parameter_name" />
     <result property="description" column="description" />
  </resultMap>

<select id="selectCommonSession" parameterClass="string" resultMap="select-sessionCommon" >
     SELECT distinct
      SP.parameter_id,
      SP.parameter_name,
      SP.description,
      SC.parameter_value ,
      SC.brand_id
FROM SESSION_INFO_COMMON as SC, SESSION_PARAMETER as SP where SP.parameter_id= SC.parameter_id and
SC.brand_id=#brandId#  group by SP.parameter_id,SP.parameter_name,
SP.description, SC.brand_id ;
  </select>


please let me know what i did wrong.


Appreciate your help,
Tony





Reply via email to