Posting our private email exchange with Malcolm Edgar regarding
Spring integration module. I was feeling the same way about it
(cayenne already does a lot of what people normally expect from
Spring), and I am glad that someone with practical Spring knowledge
confirms that. I guess one area where we can still improve the
integration is participation in external transactions (rolling back
or even replacing thread DataContext when a Spring transaction is
rolled back due to a failure outside Cayenne).
Andrus
On Feb 22, 2006, at 6:31 AM, Malcolm Edgar wrote:
> Hi Andrus,
>
> I have been looking at the Cayenne Spring integration code for the
> last few weeks, getting it working nicely with Click. I have learned a
> lot in the process, and now have a much better understanding of
> Cayenne.
>
> The interesting thing that came out of this experience is that I dont
> think there is really any significant need for Cayenne Spring
> integration, because of the way Cayenne is designed.
>
> Spring is good an providing a easy to use API wrapper around difficult
> to use APIs. However the DataContext API is very good, so the
> CayenneTemplate does not add much/any value.
>
> Spring maps checked persistence framework exceptions in
> RuntimeException making the API easier to program to. However Cayenne
> uses unchecked exceptions to this isn't an issue.
>
> Spring can provide an open session in view filter to help deal with
> Hibernates lazy loading problems in web applications. Cayenne however
> doesn't have this issue as all registered objects are "attached" and
> can lazy load when rendering in web pages.
>
> Spring provides an Transaction wrapper ontop of JDBC or Hibernate
> calls. Cayenne transactions are already nicely encapsulated in the
> DataContext.
>
> Another problem with Hibernate is that operations (transactions) than
> span multiple requests is difficult to managed, as detached object
> must be reattached to the new Session. JBOSS is attempting to address
> this issue with Seam. This issue and the lazy loading problem with
> Hibernate are difficult issues for web teams to deal with.
>
> The Cayenne session based DataContext transaction provides a unit of
> work approach which better fits the web application space.
>
> Spring assists with injecting Session dependencies in
> HibernateTemplate classs. Cayenne doesn't have this issue as the
> thread local DataContext can be obtained directly in DAO or service
> layer code.
>
> I think Spring is good for service layer code, but it hasn't really
> got much to contribute to Cayenne; possibly configuration, but that is
> a pretty marginal benefit.
>
> I will be settling on Click, Spring and Cayenne for a medical practice
> CRM application I will slowly be building over the next year.
>
> If there is anything I can do to contribute to Cayenne please let me
> know. I will do my best, but I have to admit I dont have much time
> between a new baby, work, Click and building a CRM application out of
> hours.
>
> regards Malcolm Edgar
>
> p.s. - I think Cayenne is excellent. I dont think it gets anywhere
> near the attention it deserves. I am writing up some observations on
> learning Cayenne as a newbie.
This archive was generated by hypermail 2.0.0 : Wed Feb 22 2006 - 16:49:59 EST