----- Original Message -----
From: Eric J Altman <[EMAIL PROTECTED]>
To: Turbine <[EMAIL PROTECTED]>
Sent: Tuesday, May 16, 2000 7:37 PM
Subject: Re: BasePeer problem
> John McNally wrote:
> >
> > I think this can be solved two ways. If you are selecting
> > ProjectPeer.PROJECT_ID, the join should be automatic, so I assume you
are
> > not selecting it. You can either add it to the select columns or try
>
> Will BasePeer do the joins if each scarab table is in its own map?
Do not understand the question. Different DataBaseMaps? BasePeer handles
simple joins between tables in the same db. Since a peer is generally
associated with a business object, which has an id given by the primary key
which is then used as the foreign key in other tables, BasePeer will
perform the join if you are selecting the column referenced by a foreign key
in the where clause. I was planning to add other conditions as I came
across them, but as of yet I have had no need as this case is almost always
what I am after. And for the few other cases I just write the sql out into
a CUSTOM criteria, as I have not had the time to generalize them.
>
> >
> > selectCriteria.add("forcing a join", (Object)(ProjectPeer.PROJECT_ID +
"=" +
> > ProjectVisitorPeer.PROJECT_ID), Criteria.CUSTOM );
> >
> > A bit ugly, but currently, this is the way to get any sql you want into
the
> > where clause.
>
>
> SqlExpression.buildInnerJoin?
This is what is used by BasePeer to do the join. I'm not sure how to use it
outside BasePeer in conjunction with BasePeer.
>
> ~Eric
>
>
> ------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]