You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by "Esposito, Paul" <Pa...@divine.com> on 2001/10/04 05:54:59 UTC
Using Subselect in Torque
I tried to search the archived mail for this, but didn't have any luck.
I'm trying to find an example of using a subselect through criteria
statements. Does anyone have an example?
A simple example of actual sql I'm trying to represent would look
similar to:
SELECT name
FROM resource
WHERE resourceTypeID in (SELECT id
FROM resourceType
WHERE description like
'Portlet')
I know I can flatten this query out into a straight join, but that is
not my first choice. What I ended up doing was adding the whole
subselect as a criteria.custom. Is that the best method?
Also I'm using Torque 2.1, with the 'native' IdMethod. Does any one
know if 'native' is supported in 2.1. My code works if I define it as
'sequence' for Oracle or 'autoincrement' for MSSQL, but I would rather
just use 'native' and not have to have a copy of the schema for each
target.
Thanks in advance.
Re: Using Subselect in Torque
Posted by John McNally <jm...@collab.net>.
It is the only way.
john mcnally
"Esposito, Paul" wrote:
>
> I tried to search the archived mail for this, but didn't have any luck.
> I'm trying to find an example of using a subselect through criteria
> statements. Does anyone have an example?
>
> A simple example of actual sql I'm trying to represent would look
> similar to:
>
> SELECT name
> FROM resource
> WHERE resourceTypeID in (SELECT id
> FROM resourceType
> WHERE description like
> 'Portlet')
>
> I know I can flatten this query out into a straight join, but that is
> not my first choice. What I ended up doing was adding the whole
> subselect as a criteria.custom. Is that the best method?
>
> Also I'm using Torque 2.1, with the 'native' IdMethod. Does any one
> know if 'native' is supported in 2.1. My code works if I define it as
> 'sequence' for Oracle or 'autoincrement' for MSSQL, but I would rather
> just use 'native' and not have to have a copy of the schema for each
> target.
>
> Thanks in advance.
---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org