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 Tony Qian <da...@aol.com> on 2006/01/11 19:32:11 UTC

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


Re: grougBy issue

Posted by Tony Qian <da...@aol.com>.
Sorry, never mind logging part. the doc has it.

Tony

Tony Qian wrote on 1/12/2006, 9:23 AM:

 > Gary,
 >
 > I fixed the misspelling. I still cannot get value for the property,
 > parameters. Does IBATIS have some kind of log which I can turn it on so
 > that I can see each mapping step?
 >
 > appreciate all you guys' help,
 > Tony
 >
 >
 > Gary Bradshaw wrote on 1/12/2006, 8:59 AM:
 >
 > > I'm not trying to be funny, Tony, but could the problem be that you
 > > misspelled 'parameter_value' in your result map?
 > >
 > >          <result property="value" column="paramete_value" />
 > >
 > >    - gary
 > >
 > >
 > > At 01:32 PM 1/11/2006, you wrote:
 > > >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
 > >
 > >
 > >
 > >
 > ------------------------------------------------------------------------
 > > The information contained in this communication is intended
 > > only for the use of the recipient(s) named above. It may
 > > contain information that is privileged or confidential, and
 > > may be protected by State and/or Federal Regulations. If
 > > the reader of this message is not the intended recipient,
 > > you are hereby notified that any dissemination,
 > > distribution, or copying of this communication, or any of
 > > its contents, is strictly prohibited. If you have received
 > > this communication in error, please return it to the sender
 > > immediately and delete the original message and any copy
 > > of it from your computer system. If you have any questions
 > > concerning this message, please contact the sender.
 > >
 > ------------------------------------------------------------------------
 > >
 >
 >



Re: grougBy issue

Posted by Tony Qian <da...@aol.com>.
Gary,

I fixed the misspelling. I still cannot get value for the property, 
parameters. Does IBATIS have some kind of log which I can turn it on so 
that I can see each mapping step?

appreciate all you guys' help,
Tony


Gary Bradshaw wrote on 1/12/2006, 8:59 AM:

 > I'm not trying to be funny, Tony, but could the problem be that you
 > misspelled 'parameter_value' in your result map?
 >
 >          <result property="value" column="paramete_value" />
 >
 >    - gary
 >
 >
 > At 01:32 PM 1/11/2006, you wrote:
 > >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
 >
 >
 >
 > ------------------------------------------------------------------------
 > The information contained in this communication is intended
 > only for the use of the recipient(s) named above. It may
 > contain information that is privileged or confidential, and
 > may be protected by State and/or Federal Regulations. If
 > the reader of this message is not the intended recipient,
 > you are hereby notified that any dissemination,
 > distribution, or copying of this communication, or any of
 > its contents, is strictly prohibited. If you have received
 > this communication in error, please return it to the sender
 > immediately and delete the original message and any copy
 > of it from your computer system. If you have any questions
 > concerning this message, please contact the sender.
 > ------------------------------------------------------------------------
 >



Re: grougBy issue

Posted by Gary Bradshaw <gb...@davisvision.com>.
I'm not trying to be funny, Tony, but could the problem be that you 
misspelled 'parameter_value' in your result map?

         <result property="value" column="paramete_value" />

   - gary


At 01:32 PM 1/11/2006, you wrote:
>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



------------------------------------------------------------------------
The information contained in this communication is intended
only for the use of the recipient(s) named above. It may
contain information that is privileged or confidential, and
may be protected by State and/or Federal Regulations. If
the reader of this message is not the intended recipient,
you are hereby notified that any dissemination,
distribution, or copying of this communication, or any of
its contents, is strictly prohibited. If you have received
this communication in error, please return it to the sender
immediately and delete the original message and any copy
of it from your computer system. If you have any questions
concerning this message, please contact the sender.
------------------------------------------------------------------------

Re: grougBy issue

Posted by Tony Qian <da...@aol.com>.
Ok, I found where the problem is. But I don't know why and how to solve it.
resultMap="CommonSession.elementMap" is never got called so that 
parameters is always null.

does anyone know why?

Thanks,
tony

Tony Qian wrote on 1/11/2006, 1:32 PM:

 > 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
 >