You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by sbelt <sb...@velos.com> on 2002/03/28 21:32:02 UTC

[Torque] Still trying to nest a select statement in a query

I am really stuck on this. ANY help would be appreciated.

My plan was to:
1- create criteriaA which select a single colum from my table
    (~SELECT table4.col1 FROM table4 where table4.col3 = 'findme')
2- create String myIn = "IN(" + criteriaA.toString() +")"
3- create criteriaB
4- criteriaB.add(table1.col1, (Object)myIn, Criteria.CUSTOM);

My current problem is that my criteriaA.toString() in step2 includes a bunch
of non SQL information as well. How can I fetch the String representation of
my query?

TIA,

Steve B.


----- Original Message -----
From: "sbelt" <sb...@zeroton.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, March 26, 2002 10:44 AM
Subject: [Torque] How to nest a select statement in a query


> I am trying to create the following sql:
>
> SELECT * FROM table3
>     WHERE table3.colum1 IN
>     ( SELECT table4.column1 FROM table4
>         WHERE table4.column3 LIKE '%find-me%')
>
> [forgive any typos in the above example, but I hope it expresses the
gist -
> I am trying to nest my selects so I can get my records in a single call. I
> see the .addIn() methods, but they all use java objects as parameters. Is
> there a version of the .addIn which accepts a criteria object?
>
> If I were to add this functionality myself, would you suggest using the
> torque-generated extension to the BasePeer classes? I considered using the
> util class that allows me to simply pass a select String, but I fear this
> approach runs the risk of limiting me to a single database, true?
>
> Has anyone implemented this? Is it already there and I am just not seeing
> it?
>
> TIA,
>
> Steve B.
>
>
>
>
>
> --
> 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>