Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 80470 invoked from network); 2 Aug 2006 03:17:26 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 2 Aug 2006 03:17:26 -0000 Received: (qmail 11955 invoked by uid 500); 2 Aug 2006 03:17:18 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 11448 invoked by uid 500); 2 Aug 2006 03:17:16 -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 11432 invoked by uid 99); 2 Aug 2006 03:17:16 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Aug 2006 20:17:16 -0700 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=HTML_MESSAGE,HTML_TAG_EXIST_TBODY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [202.0.15.8] (HELO perexc64.doir.wa.gov.au) (202.0.15.8) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Aug 2006 20:17:14 -0700 Received: from perexc14.internal.dom ([172.20.51.14]) by perexc64.doir.wa.gov.au with InterScan Messaging Security Suite; Wed, 02 Aug 2006 11:20:34 +0800 X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C6B5E2.18E86257" Subject: RE: JIRA 225 and discriminator tag. Date: Wed, 2 Aug 2006 11:16:51 +0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: JIRA 225 and discriminator tag. Thread-Index: Aca14RiGin4G8VevRRKnIkreH/j+EwAAOBvw From: "MCCORMICK, Paul" To: X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N This is a multi-part message in MIME format. ------_=_NextPart_001_01C6B5E2.18E86257 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable No problem, I'll provide the unit test. ________________________________ From: Jeff Butler [mailto:jeffgbutler@gmail.com]=20 Sent: Wednesday, 2 August 2006 11:09 AM To: user-java@ibatis.apache.org Subject: Re: JIRA 225 and discriminator tag. I'll take a look at this. If you can provide a reproducable test case, it would be good to add the test case to the JIRA ticket. =20 Jeff Butler =20 On 8/1/06, MCCORMICK, Paul wrote:=20 Hi,=20 I've downloaded the latest ibatis code from SVN last week as I needed the following feature: http://issues.apache.org/jira/browse/IBATIS-225 =20 I have encountered a problem. The reused result map ignores the discriminator tag. I've attached some code below. The legDiscriminatorTestFails query fails. The query should return a DisplayTenement object containing a single Legislation object. The query legDiscriminatorTestWorks works. This returns a single Legislation object. Both queries use the same args and return the same db results. In the query that fails the discriminator tag does not find a match for any sub Maps so it defaults to using the Legislation class which is abstract. Am I doing something wrong?=20 Here are the classes:=20 public class DisplayTenement { =20 private Integer id;=20 private Legislation legislation; =20 }=20 public abstract class Legislation {=20 private Integer tenementId; =20 }=20 public class SpecialProspectingLegislation82 extends Legislation {=20 }=20 =20 =20 =20 =20 =20 < discriminator column=3D"LEGISLATION_CODE" javaType=3D"java.lang.String" >=20 =20 < subMap value=3D"CWOS80" resultMap=3D"Legislation.CWOS80"/>=20 =20 < subMap value=3D"EL05NM" resultMap=3D"Legislation.EL05NM"/>=20 ..... about 20 more subMaps ......=20 =20 =20 =20 < sql id=3D"legDiscriminatorTestSQL" >=20 SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID, leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS LEGISLATION_VERSION_ID FROM EM_TENEMENT_LEGISLATION_TB leg=20 WHERE leg.LEGISLATION_ID =3D #value#=20 =20 =20 < resultMap id=3D"oneToOneTestRM" class=3D"emits.domain.tenement.DisplayTenement" >=20 =20 =20 =20 =20 =20 =20 =20 =20 "DISCLAIMER: This email, including any attachments, is intended only for use by the addressee(s) and may contain confidential and/or personal information and may also be the subject of legal privilege. If you are not the intended recipient, you must not disclose or use the information contained in it. In this case, please let me know by return email, delete the message permanently from your system and destroy any copies.=20 Before you take any action based upon advice and/or information contained in this email you should carefully consider the advice and information and consider obtaining relevant independent advice. =09 ------_=_NextPart_001_01C6B5E2.18E86257 Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable
No problem,  I'll = provide the=20 unit test.


From: Jeff Butler = [mailto:jeffgbutler@gmail.com]=20
Sent: Wednesday, 2 August 2006 11:09 AM
To:=20 user-java@ibatis.apache.org
Subject: Re: JIRA 225 and = discriminator=20 tag.

I'll take a look at this.  If you can provide a reproducable = test=20 case, it would be good to add the test case to the JIRA ticket.
 
Jeff Butler

 
On 8/1/06, MCCORMICK,=20 Paul <Paul.McCORMICK@doir.wa.gov.= au>=20 wrote:=20

Hi,
I've downloaded the latest ibatis code from SVN last week as = I needed=20 the following feature: http://issues.apache.org/jira/browse/IBATIS-225

I have encountered a = problem.  The=20 reused result map ignores the discriminator tag.   I've = attached=20 some code below.  The legDiscriminatorTestFails query = fails.   The=20 query should return a DisplayTenement object containing a single = Legislation=20 object.  The query legDiscriminatorTestWorks works.   This=20 returns a single Legislation object. Both queries use the same args = and return=20 the same db results.  In the query that fails  the = discriminator tag=20 does not find a match for any sub Maps so it defaults to using the = Legislation=20 class which is abstract.   Am I doing something wrong? =

Here are the=20 classes:
public class=20 DisplayTenement {   
    private Integer id; =
    = private Legislation=20 legislation;   
}

public = abstract class=20 Legislation {
    private Integer = tenementId;    =20
}

public class=20 SpecialProspectingLegislation82 extends Legislation  { =

} =


<resultMap id =3D"tenementLegislationRM" class=3D "Legislation" = >=20
        <result property=3D"id" column=3D"LEGISLATION_ID"/>
        = <result property=20 =3D"tenementId"=20 column=3D "TENEMENT_ID"/>=20
        <result property=3D"effectiveRange" column=3D"START_STMP"/>
        = <result property=20 =3D"versionId" column=3D=20 "LEGISLATION_VERSION_ID"/>
        = < discriminator column=3D"LEGISLATION_CODE" javaType=3D"java.lang.String" >
       =20         <subMap value=20 =3D"AMLS60" resultMap=3D "Legislation.AMLS60"/>=20
       =20         <=20 subMap value=3D"CWOS80" resultMap=3D"Legislation.CWOS80"/>
       =20         <subMap value=20 =3D"CWOS94" resultMap=3D "Legislation.CWOS94"/>=20
       =20         <=20 subMap value=3D"EL05NM" resultMap=3D"Legislation.EL05NM"/>
       =20         ..... about 20 more subMaps ......=20
        </ discriminator>
</resultMap=20 >

<!-- This is = the common=20 query used for testing -->
<=20 sql id=3D"legDiscriminatorTestSQL" >=20
        SELECT leg.LEGISLATION_ID, leg.TENEMENT_ID,=20 leg.LEGISLATION_CODE, leg.START_STMP, leg.END_STMP, leg.VERSION_ID AS=20 LEGISLATION_VERSION_ID

        FROM EM_TENEMENT_LEGISLATION_TB leg=20
        WHERE leg.LEGISLATION_ID =3D #value# =
</sql>

<!-- Re = using the result=20 map tenementLegislationRM test -->
<=20 resultMap id=3D"oneToOneTestRM" class=3D"emits.domain.tenement.DisplayTenement" >=20
        <result property=20 =3D"id" column=3D=20 "TENEMENT_ID"/>=20
        <result property=3D"legislation" resultMap=3D"Legislation.tenementLegislationRM" />
</resultMap>

<!-- = Returns a single = DisplayTenement=20 containing a Legislation object
     This query = fails. -->
<select id=3D"legDiscriminatorTestFails"=20 resultMap=3D"oneToOneTestRM" >=20
        <include refid=20 =3D"legDiscriminatorTestSQL"/>
</=20 select>

<!-- = Returnes a single = Legislation=20 object -->=20
<select id=20 =3D"legDiscriminatorTestWorks" resultMap=3D "Legislation.tenementLegislationRM" >=20
        <include refid=3D = "legDiscriminatorTestSQL"/>
</ select>


 
"DISCLAIMER: This = email,=20 including any attachments, is intended only for use by the = addressee(s)=20 and may contain confidential and/or personal information and may = also be=20 the subject of legal privilege. If you are not the intended = recipient,=20 you must not disclose or use the information contained in it. In = this=20 case, please let me know by return email, delete the message = permanently=20 from your system and destroy any copies.

Before you take = any=20 action based upon advice and/or information contained in this = email you=20 should carefully consider the advice and information and = consider=20 obtaining relevant independent=20 = advice.

= ------_=_NextPart_001_01C6B5E2.18E86257--