ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MCCORMICK, Paul" <Paul.McCORM...@doir.wa.gov.au>
Subject RE: JIRA 225 and discriminator tag.
Date Fri, 04 Aug 2006 07:08:33 GMT
I've tested it on my application and it works.  Thanks for the prompt
Paul McCormick


From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
Sent: Thursday, 3 August 2006 4:33 AM
To: user-java@ibatis.apache.org
Subject: Re: JIRA 225 and discriminator tag.

Hi Paul,
I have just committed a fix and unit test for this problem.  Get the new
source from SVN and let me know how it works for you.
Jeff Butler

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

	ok,  thanks.  I'll leave it to you then.


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

	Thanks Paul.  I've just coded a unit test for myself that is
failing like you described, so you don't need to provide another one
unless you just want to.  I'll post further comments in JIRA after I do
a little investigation. 
	Jeff Butler
	On 8/1/06, MCCORMICK, Paul <Paul.McCORMICK@doir.wa.gov.au >

		No problem,  I'll provide the unit test.


		From: Jeff Butler [mailto:jeffgbutler@gmail.com] 
		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.
		Jeff Butler
		On 8/1/06, MCCORMICK, Paul
<Paul.McCORMICK@doir.wa.gov.au > wrote: 

			I've downloaded the latest ibatis code from SVN
last week as I needed the following feature:

			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? 

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

			public abstract class Legislation { 
			    private Integer tenementId;     

			public class SpecialProspectingLegislation82
extends Legislation  { 


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

			<!-- This is the common query used for testing
			< sql id="legDiscriminatorTestSQL" > 

			        WHERE leg.LEGISLATION_ID = #value# 

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

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

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

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

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.

View raw message