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...@zeroton.com> on 2002/03/26 19:44:26 UTC

[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>


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

Posted by sbelt <sb...@velos.com>.
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>


bridging om peers and jsp/beans

Posted by Jesse Chen <je...@jalvamedia.com>.
Turbine newbie question:

I'm currently using Turbine w/ jsp's and trying to understand how to get
data from om peer objects on to the jsp page (the the proper way intended by
the framework). Is it preferable to write JavaBeans that call/manage the
peer classes and then use jsp tags to display the values? Any insights,
general or specific (sample syntax) would be greatly appreciated.

thanks,

J



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


Re: [Torque] How to nest a select statement in a query

Posted by Eric Dobbs <er...@dobbse.net>.
On Thursday, March 28, 2002, at 04:55  PM, Steve wrote:

> But what I am wondering is if there is a way to get the
> subselect statement from another criteria object? The 
> Criteria.toString()
> method has the exact query I need, it just has a bunch of unnecessary
> information in front of it.


Steve Dobie is correct:
> Use BasePeer.createQueryString(criteriaA)

The Criteria.toString() method calls
BasePeer.createQueryString(Criteria) in order to create
the part of the output that you are probably interested
in.

-Eric

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


Re: [Torque] How to nest a select statement in a query

Posted by Steve <sb...@velos.com>.
Thanks Eric!

I am doing what the archive suggests - I am creating the subselect as
Criteria.CUSTOM. But what I am wondering is if there is a way to get the
subselect statement from another criteria object? The Criteria.toString()
method has the exact query I need, it just has a bunch of unnecessary
information in front of it.

Thanks again,

Steve B.

----- Original Message -----
From: "Eric Dobbs" <er...@dobbse.net>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Wednesday, March 27, 2002 7:53 AM
Subject: Re: [Torque] How to nest a select statement in a query


>
> On Tuesday, March 26, 2002, at 11:44  AM, sbelt wrote:
>
> > 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%')
> >
> > Has anyone implemented this? Is it already there and I am just not
> > seeing
> > it?
>
>
> This is covered in the mail archive here:
> <http://www.mail-archive.com/turbine-
> user%40jakarta.apache.org/msg03764.html>
>
> Hope that helps.
> -Eric
>
>
> --
> 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>


Re: [Torque] How to nest a select statement in a query

Posted by Eric Dobbs <er...@dobbse.net>.
On Tuesday, March 26, 2002, at 11:44  AM, sbelt wrote:

> 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%')
>
> Has anyone implemented this? Is it already there and I am just not 
> seeing
> it?


This is covered in the mail archive here:
<http://www.mail-archive.com/turbine-
user%40jakarta.apache.org/msg03764.html>

Hope that helps.
-Eric


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