db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eric Emminger <e...@ericemminger.com>
Subject Re: Question regarding Peers, Joins and Criteria
Date Tue, 13 May 2003 17:05:36 GMT
Derek

Derek Hardy wrote:
> Hi
> 
> I'm trying to create a method in the PropertyPeer to reproduce the following
> SQL query
> 
> select *
>   from property p
>       ,property_stores s
>  where p.store_id = s.store_id
>    and s.owner_id = 1;
> 
> How do I define the criteria to add a restriction on the join table.

Probably something like

Criteria crit = new Criteria();
crit.addJoin(PropertyPeer.STORE_ID, PropertyStoresPeer.STORE_ID);
crit.add(PropertyStoresPeer.OWNER_ID, 1);
List results = PropertyPeer.doSelect(crit);

Eric


Mime
View raw message