Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 89594 invoked from network); 27 Mar 2009 16:13:53 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 27 Mar 2009 16:13:53 -0000 Received: (qmail 97840 invoked by uid 500); 27 Mar 2009 16:13:51 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 97822 invoked by uid 500); 27 Mar 2009 16:13:51 -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 97780 invoked by uid 99); 27 Mar 2009 16:13:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2009 16:13:51 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of brandon.goodin@gmail.com designates 209.85.220.175 as permitted sender) Received: from [209.85.220.175] (HELO mail-fx0-f175.google.com) (209.85.220.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 27 Mar 2009 16:13:41 +0000 Received: by fxm23 with SMTP id 23so1154350fxm.0 for ; Fri, 27 Mar 2009 09:13:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=r1pEjGx8WHhxCF3qacZzT0si/ARPXAwfl+PN1a2JksU=; b=YXf9+IVNey7jmmc9Ew93nYYePffWrN1tyiuYPYDhjT4q0zMIUIZ3NZWwh9+Ilw86to RVjq6Hs/JQ/DERaHhXu8Gp4dNEaVz0o3bBmwXe6w1nDHmVxXkYYoJIN3A3z2RTUk+G2p lqDbyYpvX5+AxQeA9PY9kH3xRBp/m0ifugNyo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=PGpCmQl3HBWAerfIrYUGPZnS8K9GZihLuOfURh3Eo1O+699b1rwaPgLlDoIgH1GdBj HER+vtfSbD5mAcvS4PLw8491whd6F06cKsEx8JrG38iF2wwnamqzVyU8iUdA2R+umYWC iessmY0JCqaycdI6GlW8ZA1tJ6/KcMn9dzess= MIME-Version: 1.0 Received: by 10.223.105.75 with SMTP id s11mr1813955fao.4.1238170400751; Fri, 27 Mar 2009 09:13:20 -0700 (PDT) In-Reply-To: <2fe5ef5b0903270910i3cf401ej4f64ffa9d26f7ab0@mail.gmail.com> References: <2fe5ef5b0903270859k48ef8900ndb49ed83585091ac@mail.gmail.com> <2fe5ef5b0903270910i3cf401ej4f64ffa9d26f7ab0@mail.gmail.com> Date: Fri, 27 Mar 2009 11:13:20 -0500 Message-ID: <2fe5ef5b0903270913h29130594n183b6baa63492dab@mail.gmail.com> Subject: Re: How to define alias in From: Brandon Goodin To: user-java@ibatis.apache.org Content-Type: multipart/alternative; boundary=0016e6d27ed1e8828f04661c02c4 X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d27ed1e8828f04661c02c4 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit You know rethinking your statement. It makes no sense. You just showed us the SQL. You can add an alias in the SQL. It does *not* change your table. It only changes the column name in the result. Then you just map it in the resultMap like we originally said. Brandon On Fri, Mar 27, 2009 at 11:10 AM, Brandon Goodin wrote: > You can specify the columnIndex (yuck). > > columnIndex="..."/> > property="customerDependentVo.depLastName" columnIndex ="..."/> > > Brandon Goodin > Silver Mind Software > http://www.silvermindsoftware.com > bgoodin@silvermindsoftware.com > 615-306-3652 > http://www.linkedin.com/in/bgoodin > > > > On Fri, Mar 27, 2009 at 11:03 AM, Jasmin Mehta wrote: > >> >> I can not change the column names of table QOL_DEPENDENT >> >> from FIRST_NAME to DEP_FIRST_NAME >> >> It has to be the same. >> >> >> From: Brandon Goodin To: >> user-java@ibatis.apache.org >> Date: 03/27/2009 11:59 AM Subject: Re: How to define alias in >> ------------------------------ >> >> >> > type="org.nexweb.qol.gcc.model.CustomerVO"/> >> >> >> >> >> >> >> > column="DEP_FIRST_NAME"/> >> > column="DEP_LAST_NAME"/> >> >> >> >> >> >> public class CustomerVO implements Serializable { >> private Integer custId; >> private Integer custStatus; >> private String firstName; >> private String middleName; >> private String lastName; >> >> private CustomerDependentVO customerDependentVo; >> ... all the accessor methods >> >> } >> >> public class CustomerDependentVO implements Serializable >> { >> private Integer custId; >> private String depFirstName; >> private String depLastName; >> private String depMiddleName; >> >> ... all the accessors >> } >> >> >> ****************************************************************************** >> This email and any files transmitted with it are intended solely for >> the use of the individual or agency to whom they are addressed. >> If you have received this email in error please notify the Navy >> Exchange Service Command e-mail administrator. This footnote >> also confirms that this email message has been scanned for the >> presence of computer viruses. >> >> Thank You! >> * >> ****************************************************************************** >> * >> > > --0016e6d27ed1e8828f04661c02c4 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable You know rethinking your statement. It makes no sense. You just showed us t= he SQL. You can add an alias in the SQL. It does *not* change your table. I= t only changes the column name in the result. Then you just map it in the r= esultMap like we originally said.

Brandon


On Fri, Mar 27, 2009 at 11:10 AM, Brando= n Goodin <= brandon.goodin@gmail.com> wrote:
You can specify the columnIndex (yuck).

=A0=A0 =A0 =A0 =A0<result property=3D"customerDependent= Vo.depFirstName" columnIndex=3D"..."/> =A0 =A0=A0= =A0
=A0=A0 =A0 =A0 =A0<result property=3D"custo= merDependentVo.depLastName"=A0columnIndex=A0=3D"..."/>=A0= =A0

Brandon Goodin
Silver Mind Software
http://www.silverm= indsoftware.com
bgoodin@silvermindsoftware.com
615-306-3652
http://www.linkedin.com/in/bgoodin



On Fri, Mar 27, 2009 at 11:03 AM, Jasmin= Mehta <Jasmin_Mehta@nexweb.org> wrote:

I can not change the column names = of table QOL_DEPENDENT

from FIRST= _NAME to DEP_FIRST_NAME

It has to be the same.


From: Brandon Goodin <brandon.goodin@gmail.co= m>
To:
Date: 03/27/2009 11:59 AM
Subject: Re: How to define alias in &l= t;resultMap>




<typeAlias alias=3D"customerVo"=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0 type=3D"org.nexweb.qol= .gcc.model.CustomerVO"/>=A0

<resultMap id=3D"customerRS" class=3D&quo= t;customerVo">=A0
=A0=A0 =A0 =A0 =A0<result property=3D"custStat= us" column=3D"CUST_STATUS"/>=A0
=A0=A0 =A0 =A0 =A0<result property=3D"firstNam= e" column=3D"FIRST_NAME"/>=A0
=A0=A0 =A0 =A0 =A0<result property=3D"middleNa= me" column=3D"MIDDLE_NAME"/>=A0
=A0=A0 =A0 =A0 =A0<result property=3D"lastName= " column=3D"LAST_NAME"/>=A0
=A0=A0 =A0 =A0 =A0<result property=3D"customer= DependentVo.depFirstName" column=3D"DEP_FIRST_NAME"/> =A0 =A0=A0
=A0=A0 =A0 =A0 =A0<result property=3D"customer= DependentVo.depLastName" column=3D"DEP_LAST_NAME"/>=A0
</resultMap>=A0


=A0<select id=3D"getListOfCustomersBySSNMask&q= uot; resultMap=3D"customerRS" parameterClass=3D"java.util.Map&quo= t;>=A0
=A0=A0 =A0 =A0SELECT=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0cs.cust_status, cu.first_name, =A0cu.middle_name, =A0cu.last_name,=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0dep.first_name as dep_first_name, =A0dep.last_name as dep_last_name
=A0=A0 FROM=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0 qol_customer cu,=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0 qol_dependent dep =A0 =A0 =A0 =A0 =A0 =A0=A0
=A0=A0 =A0 =A0 =A0WHERE=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0AND cu.cust_id =3D dep.cust_id =A0(+)=A0
</select>=A0

public class CustomerVO implements Serializable {=A0
=A0=A0 =A0private Integer custId; =A0 =A0=A0
=A0=A0 =A0private Integer custStatus;=A0
=A0=A0 =A0private String firstName;=A0
=A0=A0 =A0private String middleName;=A0
=A0=A0 =A0private String lastName;=A0

=A0=A0 =A0private CustomerDependentVO customerDependen= tVo;=A0=A0=A0
=A0... all the accessor methods=A0

}=A0

public class CustomerDependentVO implements Serializab= le=A0
{=A0
=A0=A0private Integer custId;=A0
=A0=A0private String depFirstName;=A0
=A0=A0private String depLastName;=A0
=A0=A0private String depMiddleName;=A0

=A0=A0... all the accessors=A0
}

***************************************************= ***************************
This email and any files transmitted with it= are intended solely for
the use of the individual or agency to whom they are addressed.
If you = have received this email in error please notify the Navy
Exchange Servi= ce Command e-mail administrator. This footnote
also confirms that this = email message has been scanned for the
presence of computer viruses.

Thank You!=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0
***********************************************************= *******************



--0016e6d27ed1e8828f04661c02c4--