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 http://i30.tinypic.com/jaz4wm.jpg )
DataContext ctx = DataContext.createDataContext();
Readers r = (Readers)DataObjectUtils.objectForPK(ctx, Readers.class, 200);
Expression e = Expression.fromString("reader=$reader");
Map param = new HashMap(1);
param.put("reader",r);
SelectQuery q = new SelectQuery(Subscriptions.class,e.expWithParameters(param));
Ordering o = new Ordering(Subscriptions.MAGZINE_PROPERTY+"."+Magzines.M_NAME_PROPERTY, true);
q.addOrdering(o);
List<Subscriptions> subs = ctx.performQuery(q);
- Nishant
--- On Wed, 16/9/09, Aristedes Maniatis <ar..aniatis.org> wrote:
From: Aristedes Maniatis <ar..aniatis.org>
Subject: Re: Sorting and Pagination in Many-to-Many relationship
To: use..ayenne.apache.org
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.
http://cayenne.apache.org/doc/caching-and-fresh-data.html
Ari Maniatis
-- --------------------------> Aristedes Maniatis GPG fingerprint CBFB 84B4 738D 4E87 5E5C 5EFA EF6A 7D2E 3E49 102A
This archive was generated by hypermail 2.0.0 : Wed Sep 16 2009 - 08:09:31 EDT