cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Eric Polino" <alu...@gmail.com>
Subject Re: questions
Date Wed, 13 Feb 2008 19:04:34 GMT
On Feb 13, 2008 1:57 PM, Kevin Menard <kmenard@servprise.com> wrote:
> Comments in-line.
>
>
> On 2/13/08 1:48 PM, "Eric Polino" <aluink@gmail.com> wrote:
>
> > I've started using Cayenne a few weeks ago for our project,
> > www.campgroundautomation.com.  In the process of working with it, I've
> > come across a few things I don't understand.  After reading the API
> > and the UserGuide, can't find much to help me.
> >
> > 1.  How do I count the rows of a query, without actually doing a full
> > blown SelectQuery and counting the elements?  ie: select count(*) from
> > table;
>
> Various aggregate queries come up rather frequently on the list.  I think
> someone posted a utility class at one time you could use.  Otherwise,
> SQLTemplate will get you there.
>
> http://cayenne.apache.org/doc/sqltemplate-basics.html
>
> > 2.  I've read in many places how Cayenne deals with joins for you, but
> > nowhere do I see an example of how its done.  Here's an example
> > problem I'm dealing with.
> >
> > Schema:
> >
> > Reservation (n to 1) Site
> > Site (n to 1)
> > Site contains a type field
> >
> > I want to get all the Reservations of a given for a given type of
> > site.  In sql I would execute something like, "select * from
> > Reservation, Site, SiteType where SiteType.Name='Something' and
> > Site.typeID = SiteType.id and Reservation.siteID = Site.id"
> >
> > Short of writing an parameterized sql string and executing that in my
> > code, how do I do that with Cayenne?  I hope I explained all that well
> > enough...make sense?
>
> Just map the relationships in the modeler.  Cayenne takes care of the SQL
> for you.  The following guide should help you get started with the modeler:
>
> http://cayenne.apache.org/doc20/tutorial-starting-mapping-project.html

I've been using the modeler and the relationships are setup, I just
don't know how to do queries based on those relationship...ie the one
mentioned above

>
> --
> Kevin
>
>



-- 
"None are more hopelessly enslaved than those who falsely believe they
are free."
                                      --Goethe

"Freedom is living without government coercion."
                   --Ron Paul (www.ronpaul2008.com)

Mime
View raw message