ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chen, Tim" <Tim.C...@NielsenMedia.com>
Subject RE: grougBy issue
Date Wed, 11 Jan 2006 21:20:14 GMT
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:daqiqian2@aol.com] 
Sent: Wednesday, January 11, 2006 1:32 PM
To: user-java@ibatis.apache.org
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



Mime
View raw message