In terms of raw mapping capabilities ("what can be mapped, and how"), hibernate basically has cayenne beat at this point. For example, hibernate supports things lie mapping to-many relationships as lists, arrays, or maps ( cayenne currently only supports mapping them as lists). Cayenne may have some mapping facilities not in hibernate, but none that I'm aware of offhand (maybe the extended types facility? Not sure if hibernate has an equivalent to that, but they probably do; oh, when I first starting using cayenne, cayenne supported "lazy" relationship fetching and hibernate did not, but hibernate now supports it).

As you mentioned, cayenne has the modeler, whereas hibernate does not offer any such support (except through 3rd parties). ANd that, in my mind, is the biggest difference. Not the modeler, but the mindset. Hibernate is about "let's make an ORM with lots of features". Cayenne is about "let's make a tool and library that makes developers productive".

When I first delved into the world of ORM, I spent three days trying to grok hibernate. Finally, recalling that some other users of tapestry were using cayenne, I tried it. Two hours later, my objects were mapped and created, my schema was created, and I was writing my objects. I've never looked back. I wish I could say that dichotomy has lessened; that the hibernate people had realized "hey, people might actually want to /use/ our project, instead of admire our technical genius from a distance", but it doesn't appear that that's the case. On their website, they have a "roadmap to getting started quickly with hibernate". Here's their roadmap:

"Day 1: Work with the tutorials

    * Download Hibernate 3.2 and extract the archive.

* Reference documentation: Read the tutorial, work with the source code in the /doc/tutorial/ directory of the Hibernate package. This tutorial covers a simple Hibernate standalone and web application.

* Java Persistence with Hibernate: Read the tutorial in the free sample chapter 2 of the book, download the Hello World code. This tutorial is a complete introduction to Hibernate, Java Persistence, and EJB 3.0.

Day 2: Read the Documentation

    * Read the rest of the reference documentation.

* Consider reading the rest of the book Java Persistence with Hibernate.

    * Read the FAQ.

Day 3: Start Coding!

* Many examples you find on the Net are still Hibernate 1.x or 2.x - read the migration guide for a list of differences to Hibernate3.

* Many good patterns can be found on the Wiki Community Area, such as Sessions and transactions, Open Session in View, Generic Data Access Objects, ...

* Once you are familiar with basic Hibernate, download the CaveatEmptor example application."
(from: http://www.hibernate.org/152.html)

That's their "getting started quickly"... any questions? ;)
(I could also point out things like: why is the web page named 152.html? Is that: 152 hours of frustration before starting hibernate? Is that 152 days of reading before you start? 152 things you have to do before you understand hibernate? Granted, the name of a web page has nothing to do with the technical quality of the hibernate code. The technical quality of the hibernate code is, I'm sure, very good. But it harks back to my original point of the paradigm of the two projects. 152.html is not a name that you could guess as a user. Similarly, the hibernate "way" is nothing something you can guess your way through and be pleasantly rewarded when something that you tried thinking "I wonder if this will work" actually does.
Now compare that to cayenne's quick start for cayenne version 2.0.
http://cayenne.apache.org/doc20/quick-start.html
Hey, look, I know what that url is telling me... and I generally know what the cayenne API is telling me and asking me, even before reading the javadocs...
without reading other tutorials...

For me, that's one of the key differences, and one of the main things that keeps in using cayenne. Keep in mind, this is all user perspective. I'm sure there are people out there who find hibernate easy to use... erm, maybe?

Robert

PS: cayenne also has ROP, which hibernate doesn't, so if you interested in writing swing front ends (truly "rich" client apps, instead of lame webapps... oops, did I say that? ;), cayenne is a no- brainer...

PPS:

On Aug 9, 2007, at 8/91:23 PM , Joe Baldwin wrote:

This is a general question I would guess at the "use case" level.

I was recently in a conversation in which I was challenged about the selection of Cayenne over Hibernate. I have only researched Hibernate & run some elementary demo tests. My conclusion was that Hibernate allows you to create a mapping via an XML metadata file but that some of the mapping responsibilities (currently found in Cayenne) are left to the programmer to resolve and maintain. I specifically pointed to Cayenne Modeler as an example of an essential tool supporting the 'change it in one place' philosophy that impacts maintenance time budgeting.

It was asserted that Hibernate could do anything that Cayenne could do. In addition, the CayenneModeler advantage was dismissed with a comment concerning an Eclipse plugin that is supposed to support the same features.

Things change very quickly in the OpenSource world so perhaps I could have made a mistake, however, I don't think that I am that far off the mark. Is there a white paper that might discuss the differences (couldn't find one at the Hibernate site)? Does anyone have an opinion?


Reply via email to