ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From AlexElba <ramal...@yahoo.com>
Subject Please help with mapping Ibatis
Date Tue, 31 Mar 2009 00:37:47 GMT

Hello,
I have a class

public class Part{
private Integer id; 
private String name;
private Bar bar;

....
getters/setters 
}

I have a mapping for part and for there part I am adding aliases for column
names after join.

I am sure it is not correct way to do it. Please advice how to do correct
way.

Current mapping looks like

  <resultMap id="part"
    class="domain.Part">
    <result property="name" column="name" />
    <result property="id" column="id" />
    <result property="bar" resultMap="part.bar" />
  </resultMap>


  <resultMap id="otherPart"
    class="domain.Part">
    <result property="name" column="otherName" />
    <result property="id" column="otherId" />
<result property="bar" resultMap="part.otherBar" />
  </resultMap>

SQL

select
p1.id,
p1.name,
b.*,
p1.id as otherId,
p1.name as otherName
from PART p1 
join BAR b on p1.id=b.p1Id
join PART p2 on p2.id=b.p2Id


Basically question is
How to map the objects if during the querying the same table is join more
then one time?



Thanks




-- 
View this message in context: http://www.nabble.com/Please-help-with-mapping-Ibatis-tp22796133p22796133.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Mime
View raw message