cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marek Wawrzyczny <marek_wawrzyc...@internode.on.net>
Subject Re: Cayenne and Spring (a Hibernate inspired question)
Date Thu, 28 Feb 2008 22:03:57 GMT
Thanks Kevin,

Your response was quite encouraging. Most of the pages are very simple but 
there is one or two which enforces quite coplex workflow. It's a perfect 
candidate for a child context.

Just out of curiosity, how do people manage contexts in a typical CRUD 
application containing several (>10) entities. We're also using  AJAX calls 
(DWR).

Regarding queries. Hibernate often handles lazy initialized relationships very 
badly. There are two bugs I've hit where both HSQL and the Criteria API (kind 
of like the query builder API in Cayenne) have trouble creating the SQL 
query. Take the following two entities:

Course
 name
 classes

Cllass
  course
 startsOn
 endsOn

Hibernate could potentially have trouble building a query that would return 
courses where we discrimante on both startsOn and endsOn properties of a 
Class.

An additional bug may prevent ordering on either startsOn or endsOn  if the 
property was used in the query.

The issue is with the way Hibernate aliases the joins in the resultset. 
Obviously, I'd want to avoid that in the future.


Cheers,

Marek Wawrzyczny

On Thu, 28 Feb 2008 00:51:59 Kevin Menard wrote:
> Hi Marek,
>
> My Hibernate experience is limited to a single project that did not use
> Spring, so it's hard for me to draw a fair comparison.  My take from
> passively watching on discussion lists (particularly the Tapestry one)
> is that Spring makes Hibernate usable in a way that Cayenne is out of
> the box.  It seems you know this already, though.
>
> In a Web app I have here, we an account creation operation split up over
> three screens and it involves several different entities.  For this, I
> simply used a peer context per page and coalesce everything at the end.
> This is a little bit older code and I would likely use a child context
> for it now.  The reason I did it this way is that while conceptually a
> single operation, completing any of the phases is a complete
> transaction.  If you want to enforce start to finish behavior, you could
> use a single context shared via session.  Just watch yourself because
> it's a lot harder to enforce a workflow through a browser than it is
> through Swing.
>
> As for sorting across multiple relationships, I guess I would have to
> understand a little more as to what you want to do.  Simplest thing is
> to write your own Comparator, but you may want to look at mapping a
> query, and barring that, use SQLTemplate to achieve what you need in the
> DB.
>
> I hope that helps.



Mime
View raw message