On Feb 24, 2011, at 2/247:09 AM , Michael Gentry wrote: > Hi Christian, > > I'm not a Hibernate expert by any stretch, but here are my high-level > notes on differences between Cayenne and Hibernate: > > * Cayenne doesn't have a LazyInitializationException (LIE). > * Cayenne doesn't have a TransientObjectException (TOE). > * Cayenne objects are NOT proxied. Cayenne objects are OO > (inheritance) while Hibernate objects are POJOs (which are then > proxied).
:) Note that this actually means that using hibernate /does/ involve inheritance, but it inverts the inheritance structure (hibernate proxies are ultimately subclasses of your POJO's). But hibernate proxies can result in some really hard to understand exceptions. ;) Also, Cayenne does throw an exception when associating two objects from different ObjectContexts... > * Cayenne doesn't need Spring for transaction management because of > the DataContext. (Technically, Hibernate doesn't need Spring either, > but Spring is quite often used to manage Hibernate.) > * Cayenne doesn't need DAOs. > * Cayenne has a native GUI. > * Cayenne has great optimistic locking support that uses real data > instead of arbitrary artifacts which are more fragile. > Pretty sure that hibernate can do optimistic locking on whichever set of columns/data you want, although people typically use a "version" which hibernate can automatically update for you. > > BTW, the LIE and TOE are what caused one project here to start using > Cayenne instead of Hibernate. > > Also, I'm not sure I'd focus as much on Cayenne vs Hibernate, but talk > about the strengths of Cayenne (GUI, DataContext, Optimistic Locking, > etc). > I definitely think that you don't want to focus too much on Cayenne vs. Hibernate, per se, unless it's to do as someone else mentioned: for people familiar with Hibernate, the Cayenne way of doing abc is xyz. Otherwise, the thing will devolve into ORM bashing. For all of its weaknesses, and despite the amount I loathe working with hibernate (having worked with it for the past 2.5 years now on a fairly large project), it does have some nice features, and really does support more "edge-case mappings" than Cayenne does. (It just supports all of its mappings in a suckier way than Cayenne. IMO, of course. ;) Robert > mrg > > > On Thu, Feb 24, 2011 at 6:01 AM, Christian Grobmeier > <[email protected]> wrote: >> Hi guys, >> >> as you might know, I am writing from time to time small articles for >> the press. I have spoken with my mag recently and they are interested >> in a new Cayenne article as I suggested. I was thinking about >> comparing Hibernate to Cayenne (there is a good email thread somewhere >> in the archives with inspiriation) but I am willing to listen for >> other suggestions. Articles are always good marketing and probably you >> have a specific topic you want to promote. Ideas? Suggestions? Let me >> know. >> >> Cheers >> Christian >>
