> From: John McNally [mailto:[EMAIL PROTECTED]]
>
> On Tue, 2002-04-30 at 04:12, Jeff Schnitzer wrote:
> >
> > There still isn't any way to add restrictions to each of the join
> > instances separately - after all, a complete crossjoin of a table
with
> > itself isn't very useful...
>
> addAlias
Ah, thanks. Reading through the ~150 methods on that class, I managed
to miss the important pieces.
So, to use the example I posted in my earlier message (selecting the
grandchildren of a particular node):
SELECT n2.*
FROM node n1, node n2
WHERE n1.parentId = 5 AND n1.id = n2.parentId
Here's some wild speculation at how to do it with Criteria:
Criteria crit = new Criteria();
crit.addAlias("n2", NodePeer.TABLE_NAME);
crit.addJoin(NodePeer.ID, "n2.parentId");
crit.add(NodePeer.PARENTID, 5);
Is that right? Is there a better way, especially one that doesn't
require me to construct "n2.parentId"?
Jeff Schnitzer
[EMAIL PROTECTED]
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>