You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-cs@ibatis.apache.org by Anderson Forteleza <af...@gmail.com> on 2006/09/28 15:05:05 UTC

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.6but 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

Re: Question resultMap

Posted by Gilles Bayon <ib...@gmail.com>.
If you install schemas in VS.NET as described in the documentation,
you will have got intellisense in VS for SqlMap/Dao.config/mapping
files and so less typing error


-- 
Cheers,
Gilles

<a href="http://www.amazon.com/gp/registry/6JCP7AORB0LE">Wish List</a>

RE: Question resultMap

Posted by Dorin Manoli <Do...@dataireland.ie>.
Fault is in 
    <typeAlias alias="Person" type="DAL.Entities.Person, DAL" />

Try: <typeAlias alias="Person" type="DAL.Entities.Person, DAL.Entities"
/>
-----Original Message-----
From: Anthony [mailto:anthony@mevspc.com] 
Sent: Thursday, September 28, 2006 3:22 PM
To: user-cs@ibatis.apache.org
Subject: Question resultMap

Can anyone tell me what I am doing wrong? Here is my following mapping

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Person"
xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <alias>
    <typeAlias alias="Person" type="DAL.Entities.Person, DAL" />
  </alias>
  
  <resutMaps>
    <resultMap id="selectResult" class="Person">
      <result property="Id" column="pid" />
      <result property="FirstName" column="firstname" />
      <result property="LastName" column="lastname" />
      <result property="Birthday" column="dob" />
    </resultMap>
  </resutMaps>

  
  <statements>

    <select id="selectAll" resultMap="selectResult">
      SELECT
      pid,
      firstname,
      lastname,
      dob  
      FROM Person
    </select>   
    
  </statements>

</sqlMap>


I am getting the following error

- The error occurred while loading SqlMap.
- loading select tag
- The error occurred in <sqlMap
resource="../../../DAL/Entities/MSSQL/Person.xml
" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the selectAll.

I know it must be something simple, can anyone help me?

Anthony



Question resultMap

Posted by Anthony <an...@mevspc.com>.
Can anyone tell me what I am doing wrong? Here is my following mapping

<?xml version="1.0" encoding="utf-8" ?>
<sqlMap namespace="Person"
xmlns="http://ibatis.apache.org/mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <alias>
    <typeAlias alias="Person" type="DAL.Entities.Person, DAL" />
  </alias>
  
  <resutMaps>
    <resultMap id="selectResult" class="Person">
      <result property="Id" column="pid" />
      <result property="FirstName" column="firstname" />
      <result property="LastName" column="lastname" />
      <result property="Birthday" column="dob" />
    </resultMap>
  </resutMaps>

  
  <statements>

    <select id="selectAll" resultMap="selectResult">
      SELECT
      pid,
      firstname,
      lastname,
      dob  
      FROM Person
    </select>   
    
  </statements>

</sqlMap>


I am getting the following error

- The error occurred while loading SqlMap.
- loading select tag
- The error occurred in <sqlMap
resource="../../../DAL/Entities/MSSQL/Person.xml
" xmlns="http://ibatis.apache.org/dataMapper" />.
- Check the selectAll.

I know it must be something simple, can anyone help me?

Anthony