You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Tom Henricksen <To...@A-t-g.com> on 2007/04/10 16:45:47 UTC

Group By and a Union, possible collision.

We are using a groupBy in our query for a report.  In this query there
is a union.  The union is for two different tables and there is a
possibility of a collision of the dispensingId that we are grouping on.
So we could have dispensingId from table one of 50001 and a dispensingId
of 50001 from table two.  These shouldn't be grouped together.  Will
iBatis account for this?  And if not is there a remedy for this?

 

<resultMap class="RxReportDataRow" groupBy="dispensingId"
extends="rxReportDataRow" id="rxReportDataRowSigDisp">

 

Thanks,

Tom


Dynamically Generated Prepared Statements

Posted by "Rafiq, Adnan" <ar...@carreker.com>.
We have a requirement where the entire sql statement has to be
dynamically generated once, and then used as a prepared statement from
that point onward (with the usual parameter bindings),
 
For example, the following statement has to be generated at runtime (by
inspecting metadata, xml files etc.):
 
INSERT INTO TABLE_A (COLUMN1, COLUMNS2, COLUMN3)
VALUES (?,?,?)
 
Does iBatis provide an API where it can be configured dynamically
without relying on an xml file.
 
 

RE: Group By and a Union, possible collision.

Posted by Tom Henricksen <To...@A-t-g.com>.
Would it be best to make the groupBy use two values one of the id and
one of the type?  We can make the groupBy use two values correct?

Thanks,
Tom

 

-----Original Message-----
From: Nathan Maves [mailto:nathan.maves@gmail.com] 
Sent: Tuesday, April 10, 2007 3:26 PM
To: user-java@ibatis.apache.org
Subject: Re: Group By and a Union, possible collision.

 

I would assume that it will not handle it in the way you would like.

How could it expect to know the difference.  They in-fact have the same
id

I could be wrong, so don't take my word for it.

Nathan 

On 4/10/07, Tom Henricksen <To...@a-t-g.com> wrote:

We are using a groupBy in our query for a report.  In this query there
is a union.  The union is for two different tables and there is a
possibility of a collision of the dispensingId that we are grouping on.
So we could have dispensingId from table one of 50001 and a dispensingId
of 50001 from table two.  These shouldn't be grouped together.  Will
iBatis account for this?  And if not is there a remedy for this?

 

<resultMap class="RxReportDataRow" groupBy="dispensingId"
extends="rxReportDataRow" id="rxReportDataRowSigDisp">

 

Thanks,

Tom

 


Re: Group By and a Union, possible collision.

Posted by Nathan Maves <na...@gmail.com>.
I would assume that it will not handle it in the way you would like.

How could it expect to know the difference.  They in-fact have the same id

I could be wrong, so don't take my word for it.

Nathan

On 4/10/07, Tom Henricksen <To...@a-t-g.com> wrote:
>
>  We are using a groupBy in our query for a report.  In this query there is
> a union.  The union is for two different tables and there is a possibility
> of a collision of the dispensingId that we are grouping on.  So we could
> have dispensingId from table one of 50001 and a dispensingId of 50001 from
> table two.  These shouldn't be grouped together.  Will iBatis account for
> this?  And if not is there a remedy for this?
>
>
>
> <resultMap class="RxReportDataRow" groupBy="dispensingId"
> extends="rxReportDataRow" id="rxReportDataRowSigDisp">
>
>
>
> Thanks,
>
> Tom
>