cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nishant Neeraj <>
Subject Re: Sorting and Pagination in Many-to-Many relationship
Date Wed, 16 Sep 2009 11:41:56 GMT
Thanks for imformative link.

I have just started Cayenne and trying to get used to it. In the same set of exercise, I was
trying to pull a list of Subscriptions (paginated) sorted by magzine name.

I did this, wondering if this is the most correct way to do it. (refer data model here

DataContext ctx = DataContext.createDataContext();
Readers r = (Readers)DataObjectUtils.objectForPK(ctx, Readers.class, 200);
Expression e = Expression.fromString("reader=$reader");
Map param = new HashMap(1);
SelectQuery q = new SelectQuery(Subscriptions.class,e.expWithParameters(param));		
Ordering o = new Ordering(Subscriptions.MAGZINE_PROPERTY+"."+Magzines.M_NAME_PROPERTY, true);

List<Subscriptions> subs = ctx.performQuery(q);

- Nishant
--- On Wed, 16/9/09, Aristedes Maniatis <> wrote:

From: Aristedes Maniatis <>
Subject: Re: Sorting and Pagination in Many-to-Many relationship
Date: Wednesday, 16 September, 2009, 7:22 AM

On 16/09/09 6:22 AM, Nishant Neeraj wrote:
> A question regarding caching. When we use SQLTemplate or Expression, does the objects
gets cached? I mean, these are very frequent used piece of code.... as soon as user logs in
we will show his list of Magazines... if the object is not cached, we may have sluggish performance
under load.

For improved caching you definitely want to be using Cayenne 3. And the answer is that Cayenne
does a very good job of caching, but you'll want to read the documentation carefully to understand
what is going on.

Ari Maniatis

Aristedes Maniatis
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

      Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message