ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ted Schrader" <tschra...@gmail.com>
Subject Re: Using Joins
Date Wed, 19 Apr 2006 13:31:05 GMT
Hi Suresh,

Give us your current SQLMap XML for this, and the code for the beans/POJOs
involved.  Without seeing the configuration of your result maps, it's hard
to help you.

Ted

On 18/04/06, suresh.dodda@wipro.com <suresh.dodda@wipro.com> wrote:
>
>  I am using following select query.
>
>
>
> Select * from Emp e, Ddept dt where e.empNo = dt.empNo;
>
> I have defined two result maps. First result map contains list of second
> result map.
>
> The data base has the following data:
>
> Emp table:
>
> empNo empName
>
> 1                     xxx
>
> 2                     yyy
>
> 3                     zzz
>
> Dept table:
>
> empNo  deptName
>
> 1                     dept-xxx-1
>
> 1           dept-xxx-2
>
> 2                     dept-yyy-1
>
> 2           dept-yyy-2
>
> when i run the query i am getting the four results.
>
> where i am expecting two results.  The resultMap1 should contains
> resultMap2 as a list, but for every detail record
>
> one master record is returned.
>  ------------------------------
>
> *From:* Ted Schrader [mailto:tschrader@gmail.com]
> *Sent:* Tuesday, April 18, 2006 8:34 PM
> *To:* user-java@ibatis.apache.org
> *Subject:* Re: Using Joins
>
>
>
> Hi Suresh,
>
> Give us the select statement you have right now so we can see.
>
> In the meantime, try:
>
> SELECT *
>   FROM Employee e INNER JOIN
>        Dept d ON e.empId = d.empId
>
> Ted
>
> On 18/04/06, suresh.dodda@wipro.com < suresh.dodda@wipro.com> wrote:
> >
> >
> >
> >
> > I am trying find the results from the multiple tables.
> >
> >
> >
> > I have Employee table with empId and empname.  Dept table with empId and
> deptno, dept-name
> >
> > There are only two rows in master and two corresponding rows in the
> detail tables.
> >
> >
> >
> > When I am using the Inner join I am getting the four results. Where as I
> am expecting two results. Each result inturn should contains
> >
> > Two detail records.
> >
> >
> >
> > Can you please give the query syntax to fetch the data from multiple
> table using the join.
> >
> >
> >
> >
> >
> >  The information contained in this electronic message and any
> attachments to this message are intended for the exclusive use of the
> addressee(s) and may contain proprietary, confidential or privileged
> information. If you are not the intended recipient, you should not
> disseminate, distribute or copy this e-mail. Please notify the sender
> immediately and destroy all copies of this message and any attachments.
> >
> >  WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
> >
> >  www.wipro.com
> >
>
> The information contained in this electronic message and any attachments
> to this message are intended for the exclusive use of the addressee(s) and
> may contain proprietary, confidential or privileged information. If you are
> not the intended recipient, you should not disseminate, distribute or copy
> this e-mail. Please notify the sender immediately and destroy all copies of
> this message and any attachments.
>
> WARNING: Computer viruses can be transmitted via email. The recipient
> should check this email and any attachments for the presence of viruses. The
> company accepts no liability for any damage caused by any virus transmitted
> by this email.
>
> www.wipro.com
>

Mime
View raw message