cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Kienenberger" <mkien...@gmail.com>
Subject Re: joins
Date Thu, 22 May 2008 21:37:09 GMT
Expression qualifier = ExpressionFactory.matchExp(
                            Reservation.SITE_RELATIONSHIP_PROPERTY
                            + Site.SITE_TYPE_RELATIONSHIP_PROPERTY
                            + SiteType.NAME_ATTRIBUTE_PROPERTY,
                            "foo");

SelectQuery query = new SelectQuery(Reservation.class, qualifier );

On 5/22/08, Eric Polino <eric@campgroundautomation.com> wrote:
> On Thu, May 22, 2008 at 5:23 PM, Eric Polino
>  <eric@campgroundautomation.com> wrote:
>  > Given three tables (This is not accurate SQL syntax...but you get the point).
>  >
>  > Reservation {
>  >  ...
>  >  siteId  int foreign key with Site,
>  >  ...
>  > }
>  >
>  > Site {
>  >  ...
>  >  siteId int primary key,
>  >  typeId int foreign key with SiteType,
>  >  ...
>  > }
>  >
>  > SiteType {
>  >  ...
>  >  siteTypeId int primary key,
>  >  name varchar(32),
>  >  ...
>  > }
>  >
>  > How can I do the following SQL statement using Expression,
>  > ExpressionFactory, SelectQuery, etc?
>  >
>  > select * from Reservation r, Site s, SiteType st where r.siteId =
>  > s.siteId and s.typeId = st.siteTypeId and st.name = 'foo'
>  >
>
>
> I'm actually trying to get Reservation objects, so it's not '*' I'm
>  selecting but more like r.field1, r.field2,...  But Cayenne can take
>  care of that for me when the time comes I'm sure.
>
>
>  > TIA.
>  >
>  > --
>  > Eric Polino
>  > Campground Automated Systems
>  >
>
>
>
>  --
>  Eric Polino
>  Campground Automated Systems
>

Mime
View raw message