Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 14806 invoked from network); 13 Jan 2006 01:55:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 13 Jan 2006 01:55:16 -0000 Received: (qmail 56411 invoked by uid 500); 13 Jan 2006 01:55:15 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 56314 invoked by uid 500); 13 Jan 2006 01:55:14 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 56301 invoked by uid 99); 13 Jan 2006 01:55:14 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jan 2006 17:55:14 -0800 X-ASF-Spam-Status: No, hits=1.0 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE,NO_REAL_NAME,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of DaqiQian2@aol.com designates 64.12.137.6 as permitted sender) Received: from [64.12.137.6] (HELO imo-m25.mx.aol.com) (64.12.137.6) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 12 Jan 2006 17:55:12 -0800 Received: from DaqiQian2@aol.com by imo-m25.mx.aol.com (mail_out_v38_r6.3.) id k.233.51a7003 (4328) for ; Thu, 12 Jan 2006 20:54:46 -0500 (EST) From: DaqiQian2@aol.com Message-ID: <233.51a7003.30f86266@aol.com> Date: Thu, 12 Jan 2006 20:54:46 EST Subject: Re: groupBy issue To: user-java@ibatis.apache.org MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="-----------------------------1137117286" X-Mailer: 9.0 for Windows sub 5120 X-Virus-Checked: Checked by ClamAV on apache.org X-Old-Spam-Flag: NO X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N -------------------------------1137117286 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Mark and Tim, Thanks your help. I checked all of your suggestions. It still doesn't work. Here are the info for scaled down version. class info public class SessionCommon { private List parameters; private String brandId; public void setBrandId(String id){ this.brandId = id; } public String getBrandId(){ return this.brandId; } public void setParameters(List elements){ this.parameters = parameters; } public List getParameters(){ return this.parameters; } public SessionCommon(){ brandId = null; parameters = null; } } public class SessionElement { private Parameter parameter; private String value; public void setParameter(Parameter parameter){ this.parameter = parameter; } public Parameter getParameter(){ return this.parameter; } public void setValue(String value){ this.value = value; } public String getValue(){ return this.value; } public String toString() { return ReflectionToStringBuilder.toString(this); } public SessionElement(){ parameter = new Parameter(); value = null; } public class Parameter { private String parameterName; private String parameterId; private String description; public void setParameterName(String name){ this.parameterName = name; } public String getParameterName(){ return this.parameterName; } public void setParameterId(String id){ this.parameterId = id; } public String getParameterId(){ return this.parameterId; } public void setDescription(String id){ this.description = id; } public String getDescription(){ return this.description; } public Parameter(){ //empty } public String toString() { return ReflectionToStringBuilder.toString(this); } mapping info log info DEBUG 01-12 17:33:37 Created connection 3735543. (JakartaCommonsLoggingImpl.jav a:23) DEBUG 01-12 17:33:37 {conn-100000} Connection (JakartaCommonsLoggingImpl.java:2 3) DEBUG 01-12 17:33:37 {pstm-100001} PreparedStatement: SELECT distinct S P.parameter_id, SP.parameter_name, SP.description, SC.parameter_valu e , SC.brand_id FROM SESSION_INFO_COMMON as SC, SESSION_PARAMETER as SP where SP.parameter_id=SC.parameter_id and brand_id=?; (JakartaCommonsLoggi ngImpl.java:23) DEBUG 01-12 17:33:37 {pstm-100001} Parameters: [2] (JakartaCommonsLoggingImpl.j ava:23) DEBUG 01-12 17:33:37 {pstm-100001} Types: [java.lang.String] (JakartaCommonsLog gingImpl.java:23) DEBUG 01-12 17:33:37 {rset-100002} ResultSet (JakartaCommonsLoggingImpl.java:23 ) DEBUG 01-12 17:33:37 {rset-100002} Header: [brand_id, parameter_value, parameter _id, parameter_name, description] (JakartaCommonsLoggingImpl.java:23) DEBUG 01-12 17:33:37 {rset-100002} Result: [2, 78, 3, auth_challenge, Used by th e client for hashing the user's password in preparation for web authentication.] (JakartaCommonsLoggingImpl.java:23) DEBUG 01-12 17:33:37 {rset-100002} Result: [2, http://xx.office.c/ om:9580/session/session_start.jsp, 4, auth_url, Page where the client should dir ect the user to start the web-based authentication process.] (JakartaCommonsLog gingImpl.java:23) DEBUG 01-12 17:33:37 {rset-100002} Result: [2, 78, 5, ces_heartbeat, How often t he client should monitor the connection in minutes] (JakartaCommonsLoggingImpl. java:23) DEBUG 01-12 17:33:37 Returned connection 3735543 to pool. (JakartaCommonsLoggin The log info marked blue told us resultMap got data required to build SessionCommon. The funny thing is that only this query didn't work. Other queries using groupBy worked properly. is it possible that this is due to mismatch of data type of brandId (dataType of brand_id is tinyint in database)? btw, I'm using latest version of iBATIS and MySQL 5.0 thanks, Tony -------------------------------1137117286 Content-Type: text/html; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable
Mark and Tim,
 
Thanks your help.  I checked all of your suggestions. It still doe= sn't work.
 
Here are the info for scaled down version.
 
class info
 
public class SessionCommon
{
    private List par= ameters;
    private String brandId;

   &= nbsp;public void setBrandId(String id){
       &= nbsp;this.brandId =3D id;
    }
    publ= ic String getBrandId(){
        return this= .brandId;
    }
    public void setParam= eters(List elements){
        this.paramete= rs =3D parameters;
    }
    public List= getParameters(){
        return this.param= eters;
    }
    public SessionCommon(){=
        brandId =3D null;
  =20=      parameters =3D null;
    }
}
public class SessionElement
{
    private Parame= ter parameter;
    private String value;

 &nbs= p;  public void setParameter(Parameter parameter){
   = ;     this.parameter =3D parameter;
    }    public Parameter getParameter(){
   =20=     return this.parameter;
    }
 &= nbsp;  public void setValue(String value){
     =    this.value =3D value;
    }
  &n= bsp; public String getValue(){
        retu= rn this.value;
    }
   
  = ;  public String toString() {
      &n= bsp; return ReflectionToStringBuilder.toString(this);
   =20= }
 
    public SessionElement(){
          parameter =3D ne= w Parameter();
          value =3D null;<= /DIV>
}

public class Parameter
{
    private String p= arameterName;
    private String parameterId;
 &nb= sp;  private String description;

    public void=20= setParameterName(String name){
        this= .parameterName =3D name;
    }
    publi= c String getParameterName(){
        return= this.parameterName;
    }
    public vo= id setParameterId(String id){
        this.= parameterId =3D id;
    }
    public Str= ing getParameterId(){
        return this.p= arameterId;
    }

    public void se= tDescription(String id){
        this.descr= iption =3D id;
    }
    public String g= etDescription(){
        return this.descri= ption;
    }

    public Parameter(){=
        //empty
    }
    public String toString() {
   &nbs= p;    return ReflectionToStringBuilder.toString(this);
&nb= sp;   }
mapping info

<sqlMap namespace=3D"CommonSession">

  <typeAl= ias alias=3D"sessionCommon" type=3D"com.netscape.isp.quickstart.SessionCommo= n"/>
  <typeAlias alias=3D"element" type=3D"com.netscape.isp.q= uickstart.SessionElement"/>
 
  <resultMap id=3D"elem= entMap" class=3D"element">
  <result property=3D"value" column= =3D"parameter_value"/>
  <result property=3D"parameter.paramet= erId" column=3D"parameter_id"/>
  <result property=3D"paramete= r.parameterName" column=3D"parameter_name"/>
  <result propert= y=3D"parameter.description" column=3D"description"/>
  </resul= tMap>
 
  <resultMap id=3D"selectSessionCommon" class= =3D"sessionCommon" groupBy=3D"brandId">
  <result property=3D"= brandId" column=3D"brand_id"/>
  <result property=3D"parameter= s" resultMap=3D"CommonSession.elementMap"/>
  </resultMap><= BR> 
  <select id=3D"selectCommonSession" parameterClass= =3D"string" resultMap=3D"selectSessionCommon">
    &nbs= p; SELECT distinct
       SP.parameter_id,
&= nbsp;      SP.parameter_name,
    &nbs= p;  SP.description,
       SC.parameter_val= ue ,
       SC.brand_id
    &= nbsp;  FROM SESSION_INFO_COMMON as SC, SESSION_PARAMETER as SP where SP= .parameter_id=3DSC.parameter_id and brand_id=3D#brandId#;
  </se= lect>
 
</sqlMap>
log info

DEBUG 01-12 17:33:37 Creat= ed connection 3735543.  (JakartaCommonsLoggingImpl.jav
a:23)
DEBU= G 01-12 17:33:37 {conn-100000} Connection  (JakartaCommonsLoggingImpl.j= ava:2
3)
DEBUG 01-12 17:33:37 {pstm-100001} PreparedStatement: &n= bsp;   SELECT distinct      S
P.parame= ter_id,     SP.parameter_name,     S= P.description,     SC.parameter_valu
e ,  &= nbsp;  SC.brand_id      FROM SESSION_INFO_COMM= ON as SC, SESSION_PARAMETER as SP
 where SP.parameter_id=3DSC.parame= ter_id and brand_id=3D?;      (JakartaCommonsLoggi<= BR>ngImpl.java:23)
DEBUG 01-12 17:33:37 {pstm-100001} Parameters: [2]&nbs= p; (JakartaCommonsLoggingImpl.j
ava:23)
DEBUG 01-12 17:33:37 {pstm-100= 001} Types: [java.lang.String]  (JakartaCommonsLog
gingImpl.java:23)=
DEBUG 01-12 17:33:37 {rset-100002} ResultSet  (JakartaCommonsLoggin= gImpl.java:23
)
DEBUG 01-12 17:33:37 {rset-10000= 2} Header: [brand_id, parameter_value, parameter
_id, parameter_name, des= cription]  (JakartaCommonsLoggingImpl.java:23)
DEBUG 01-12 17:33:37=20= {rset-100002} Result: [2, 78, 3, auth_challenge, Used by th
e client for=20= hashing the user's password in preparation for web authentication.]
 = ; (JakartaCommonsLoggingImpl.java:23)
DEBUG 01-12 17:33:37 {rset-100002}=20= Result: [2,
http://xx.office.c/
<= FONT color=3D#0000ff>om:9580/session/session_start.jsp, 4, auth_url, Page wh= ere the client should dir
ect the user to start the web-based authenticat= ion process.]  (JakartaCommonsLog
gingImpl.java:23)
DEBUG 01-12 1= 7:33:37 {rset-100002} Result: [2, 78, 5, ces_heartbeat, How often t
he cl= ient should monitor the connection in minutes]  (JakartaCommonsLoggingI= mpl.
java:23)
DEBUG 01-12 17:33:37 Retur= ned connection 3735543 to pool.  (JakartaCommonsLoggin
The log info marked blue told us resultMap got data required to build S= essionCommon. The funny thing is that only this query didn't work. Other que= ries using groupBy worked properly. is it possible that this is due to misma= tch of data type of brandId (dataType of  brand_id is tinyint in d= atabase)?  
 
btw, I'm using latest version of iBATIS and MySQL 5.0 
 
thanks,
Tony
-------------------------------1137117286--