Mitch Pronschinske is a Senior Content Analyst at DZone. That means he writes and searches for the finest developer content in the land so that you don't have to. He often eats peanut butter and bananas, likes to make his own ringtones, enjoys card and board games, and is married to an underwear model. Mitch is a DZone Zone Leader and has posted 2574 posts at DZone. You can read more from them at their website. View Full User Profile

Apache Cayenne 3.0 and the State of the Project

  • submit to reddit
After 9 years as an active Top Level Project at Apache, the Cayenne project released version 3 of its ORM and remoting services persistence framework.  Cayenne VP Andrus Adamchik believes that Cayenne 3.0 has what it takes to compete with the best Java ORMs like Hibernate.  The foundations of Cayenne's design provide 'rich' persistent objects and a clean separation between the mapping model and Java code.  Adamchik says those choices have endured for nearly a decade: "they survived POJO/annotation hype rather well,enabling smooth database access experience and a number of rather unique features not found (maybe even not possible) in other ORMs."  Cayenne 3.0 continues to extend the abilities of its ORM with those founding principles in mind.

Cayenne supports database reverse engineering and generation, as well as a Velocity-based class generation engine.  These utilities are controlled through the CayenneModeler GUI tool, requiring no XML or annotation based configuration.  Cayenne also provides database generation, Web Services and non-Java client integration, schema mapping, on-demand object and relationship faulting, database auto-detection, and more.

A very long list of additional features were added to Cayenne 3.0.  The upgrade drops right into an older existing Cayenne project, and the only problems with backward compatibility would be that the saved files in CayenneModeler 3.0 don't work with previous versions.  Cayenne committers thought about building a JPA provider on top of the runtime, but ultimately decided to stay away from JPA.  Many of the new features came out of this idea however.  

Java 5 is now the minimum requirement for Cayenne 3.0 and generics are now supported.  Object properties can be mapped to columns from a joined table over one or more joins.  You can also declare a callback method on an entity object or declare a listener class, or register it via API, to receive entity events, JPA-style.

Other features include:

  • A Pluggable Query Cache
  • EJBQL Object Queries as Strings
  • SelectQuery improvements
  • More Tools for CayenneModeler
  • Performance Improvments

Adamchik explained what developers who used Cayenne for the first time thought about it:

"Programmers who haven't used Cayenne before will find it a powerful and easy to use ORM, distinguished from other ORM tools by a clean and intuitive API, powerful three tier (ROP) option, flexible caching, a GUI modeler tool and much more. Cayenne is extremely stable; its huge suite of tests and long history mean that it is fast and reliable."

The project website cites three points that set Cayenne apart form other ORMs

  1. Cayenne can work in three-tier (ROP) mode connecting multiple clients through remote Cayenne controlled services, not JDBC.  This brings more control to caching and centralized validation through a variety of clients.
  2. Cayenne can use generic classes and define the mapping dynamically at runtime without needing to know the class at compile time and without bytecode manipulation.
  3. Nested contexts provide an arbitrary number of nesting levels for commit/rollback operations so users can create "scratch contexts" for working with objects and preserving a larger set of uncommitted changes.

Future Releases
Planning and development for Cayenne 3.1 is well underway.  A dependency injection container is already available in the project's Subversion trunk.  The committers don't want to introduce a complex new runtime like Spring or Guice yet.  The DI container won't create version conflicts with these runtimes.  3.1 will also finalize the support of generics in queries.

ObjectStyle offers commercial support for Apache Cayenne.  You can download Cayenne here.  The newly released Technical Fact sheet can be found here


Erdinç Kocaman replied on Wed, 2010/07/07 - 12:10pm

A very good alternative to JPA/Hibernate stack. It is 9-years project but concepts behind it are older than 9 years.

Karol Lalol replied on Wed, 2010/07/07 - 1:08pm

Well, I like non mainstream technologies so I tried Cayenne for some small project. I was pretty disappointed by absence of something like auto-increment property, and I have some troubles with values in the cayenne's context containers too. This was not necessarily bad, however I wasn't able find some documentation, or real world examples/best practices. This led me to abandon Cayenne. Maybe it's time to try again :)

Erdinç Kocaman replied on Wed, 2010/07/07 - 4:01pm in response to: Karol Lalol

I would recommend you to try it again. It is both powerful and practical to use framework. You can do more work in less time.

Andrus Adamchik replied on Fri, 2010/07/09 - 8:09am in response to: Karol Lalol

Our user mailing list can totally compensate for the lack of third-party documentation. So please come back and start asking questions :-)

Adedayo Abiodun replied on Fri, 2011/05/06 - 8:34am in response to: Andrus Adamchik

As much as there might be a good user community within your mailing list, a search on Dzone on Cayenne doesn't seem to yield much results. Which indicates to me people are probably not blogging enough about it. I will like to try it out. Would be nice to have more people post about it.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.