ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Larry Meadors" <larry.mead...@gmail.com>
Subject Re: Same relational link, multiple times, different names
Date Fri, 26 Sep 2008 11:26:23 GMT
You'll have to either use position (bad idea) or alias the results (do that):

  blah, blah, blah,
  cleric.user_id as clericUserId, /* other cleric.fields as clericXxx */
  doctor.user_id as doctorUserId, /* other pricer.fields as pricerXxx */
  pricer.user_id as pricerUserId /* other pricer.fields as pricerXxx */
from claim
join user cleric on claim.cleric_id = cleric.user_id
join user doctor on claim.doctor_id = doctor.user_id
join user pricer on claim.pricer_id = pricer.user_id
  /* whatever */

Remember, ibatis just runs your sql, then maps the results to objects
- it's doesn't know (or care) what the SQL is or the source of the


On Thu, Sep 25, 2008 at 10:21 PM, Jeremy Cowgar <jeremy@cowgar.com> wrote:
> Hello,
> I have a Users table then a Claim table. The Claim table links to the User
> table many times. For instance: cleric_id, doctor_id, pricer_id ... all of
> those are different users performing well defined roles with the claim. I
> know how to link 1 of them via a SqlMap. I have a resultSet defined but it's
> field names are like:
> How can I handle mapping CLERIC_ID, CLERIC_CODE, ... DOCTOR_ID, DOCTOR_CODE,
> ... in one select with out having to create 3 resultMaps ?
> Thank you,
> Jeremy

View raw message