You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by George Papastamatopoulos <Ge...@lawlex.com.au> on 2002/05/22 04:38:58 UTC

Criteria table joins on the same table

Hi
I have a query that looks like this


SELECT A.ID FROM
TABLE A A, TABLE B
WHERE (A.col_1 = some_value) AND
(
  (A.col_2 = B.col_2) AND
  (
    (B.id = another_value)
  )
)

I'm having trouble representing this using Criteria objects. Does anyone
know if this is possible, if so could you point me in the right direction?

Thanks
George Papastamatopoulos

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Criteria table joins on the same table

Posted by John McNally <jm...@collab.net>.
I do not see a "self join" here, it looks like a standard query that is
handled well by Criteria

crit.add(APeer.COL1, someVal);
crit.addJoin(APeer.COL2, BPeer.COL2);
crit.add(BPeer.ID, anotherVal);

why is the alias even needed?

john mcnally

On Tue, 2002-05-21 at 19:38, George Papastamatopoulos wrote:
> Hi
> I have a query that looks like this
> 
> 
> SELECT A.ID FROM
> TABLE A A, TABLE B
> WHERE (A.col_1 = some_value) AND
> (
>   (A.col_2 = B.col_2) AND
>   (
>     (B.id = another_value)
>   )
> )
> 
> I'm having trouble representing this using Criteria objects. Does anyone
> know if this is possible, if so could you point me in the right direction?
> 
> Thanks
> George Papastamatopoulos
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
> 
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>