Re: joins

From: Mike Kienenberger (mkienen..mail.com)
Date: Thu May 22 2008 - 17:37:09 EDT

  • Next message: Eric Polino: "Re: joins"

    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 <eri..ampgroundautomation.com> wrote:
    > On Thu, May 22, 2008 at 5:23 PM, Eric Polino
    > <eri..ampgroundautomation.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
    >



    This archive was generated by hypermail 2.0.0 : Thu May 22 2008 - 17:37:43 EDT