ibatis-user-cs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Schall" <mike.sch...@gmail.com>
Subject Re: FW: Question about Inheritance Support
Date Tue, 05 Dec 2006 14:51:29 GMT
If you are asking simply for the resultmap, I think you want the
"extends" keyword...

<resultMaps>
	<resultMap id="PersonResultMap" class="Person" >
		<result column="PersonID" property="PersonID" />
		<result column="Name" property="Name" />
		<result column="Address" property="Address" />
	</resultMap>
	<resultMap id="StudentResultMap" class="Student"  extends="PersonResultMap">
		<result column="StudentID" property="StudentID" />
		<result column="Grade" property="Grade" />
	</resultMap>
</resultMaps>

On 12/5/06, Dorin Manoli <Dorin.Manoli@dataireland.ie> wrote:
>
>
>
>
> Can anyone give response? I can't find reply emails through Archive search.
>
> I'm facing the same problem.
>
>
>
>  ________________________________
>
>
> From: Anderson Forteleza [mailto:afortaleza@gmail.com]
>  Sent: Thursday, September 28, 2006 2:05 PM
>  To: user-cs@ibatis.apache.org
>  Subject: Question about Inheritance Support
>
>
>
> Hello ! I'm new to iBatis and I'm trying to setup resultMaps with
> inheritance support. I've read the Data Mapper Guide v1.5.1 section 3.5.6
> but the case studied there is not the same as the case I have here, my case
> is really simple, I have 2 tables and 2 classes:
>
>  Person
>  =====
>  PersonID
>  Name
>  Address
>
>  Student
>  ======
>  StudentID
>  PersonID
>  Grade
>
>  public class Person { ... }
>
>  public class Student : Person { ... }
>
>  My idea was that I could setup 2 resultMaps, Person and Student, and relate
> them with inheritance, meaning that when I called the resultMap for the
> Student it would also call the resultMap for Person, but I don't know if
> that is possible. Can somebody give me a hand on how to deal with that
> problem ? I just didn't want to have one select for Person and a JOIN select
> for Student.
>
>  thank you
>  Anderson Fortaleza

Mime
View raw message