The new version of Apache Cayenne, an open source Java framework for object relational mapping and persistence, supports Remote Object Persistence and ORM Modeling Tools. Version 3.0 of the framework was released back in May. With Cayenne's Remote Object Persistence feature, Java objects can be persisted out to clients via Web Services. The framework also supports database reverse engineering and generation, as well as a Velocity-based class generation engine.

InfoQ caught up with Andrus Adamchik (VP) and Aristedes Maniatis (Project Management Committee member) from Cayenne team to speak about features in the new version and future road map of the framework.

Cayenne is actually the older project. Its first release was in July 2002 and moved to Apache in 2006. At any rate, Apache often has overlapping projects with similar goals and this adds to the choice for end-users. Each ORM has a different focus and offers different solutions to similar problems. We are all enriched by the choice available.

No. There was a lot of work spent on implementing the first version of JPA specification, however it was decided in 2008 to abandon that approach. Not only was it a lot of work, but it restricted the ability of Cayenne to implement more innovative approaches. We had strong support from the user base and we believe that developers choose Cayenne for the clean API and the additional features it offers. These things aren't always compatible with following a rigid standard. Cayenne does support almost all of the JPA concepts through, including the ability to execute EJBQL.

InfoQ: Does Cayenne framework provide any features outside the JPA spec?

Yes. Cayenne offers a number of innovative features such as (1) ROP (Remote Object Persistence) which allows remote Java applications to access Cayenne web service instead of directly accessing the database. This allows for separation of business logic between multiple application tiers, with each tier using the same persistence APIs; (2) generic objects mapping, allowing to instantiate mapping dynamically in runtime instead of compile time; (3) nested ObjectContexts. Cayenne also has a 'modeler' application developed by the same team which makes it easier to visualise the database and Java hierarchy, and which is always in sync with the most current framework version.

InfoQ: What type of monitoring support is provided by Cayenne framework for the developers and Operators to view persistence and caching details?

Cayenne supports a callback/listener mechanism similar to JPA. It also has extensive logging built in. JMX extensions to monitor the underlying stack have been already prototyped and will likely be included in upcoming 3.1. Also since Cayenne query cache is pluggable, users can rely on event mechanism of their cache provider to implement JMX monitoring of cache independently from Cayenne. This has been actually done on some projects we are aware of.

InfoQ: Can you discuss the new Dependency Injection (DI) container feature that will be part of the future release of the framework?

Cayenne DI container is small (about 35K in size), XML-free, easy to use and has no external dependencies (not even on Cayenne). It's goal is to load and manage the Cayenne runtime, but otherwise to stay as unassuming as possible. This means it won't interfere with applications' use of Spring, Guice, etc. It will just deal with Cayenne, and provide extension points for users to customize Cayenne behavior.

Implementation-wise it is influenced by Google Guice. Dependencies are configured via constructor or field annotations. Most common DI features are supported - binding of classes, instances or instance providers, binding of named maps and lists, merging multiple modules into one container on startup, binding scopes, fluent binding API, lazy instantiation. Unlike Guice, our DI has a concept of scope lifecycle which is very important for a framework like Cayenne. DI-managed objects can annotate their methods to receive scope events, most often to release some resources at the end of the scope. Users can easily create their own scopes and set up custom events (e.g. a web request scope). Considering the small size of the DI jar, that is quite a lot of features. The only important DI piece missing is dynamic proxies and interception. We may still add that in the future.

InfoQ: What is the future road map of Apache Cayenne project in terms of new features and enhancements?

Recent discussions and work have included: a new query API fully supporting generics, and reconciling JPA-style EJBQLQuery with Cayenne traditional SelectQuery; support for merging of multiple mapping projects into one in runtime to improve modularity; ongoing work to deal with the idiosyncrasies of different databases; taking advantage of the DI capabilities to refactor the core services for ease of extension (this also covers the above-mentioned JMX extensions); enhancements to the Cayenne Modeler to make it more powerful and easier to use.

But as with all open source projects, exactly what is developed will be driven by user demand and where the most productive advances can be made with the given developer resources.

InfoQ Weekly Newsletter

Join a community of over 250 K senior developers by signing up for our newsletter. If you are based in the EEA, please contact us so we can provide you with the protections afforded to you under EEA protection laws.

Is your profile up-to-date? Please take a moment to review and update.

Email Address

Note: If updating/changing your email, a validation request will be sent

Company name:

Keep current company name

Update Company name to:

Company role:

Keep current company role

Update company role to:

Company size:

Keep current company Size

Update company size to:

Country/Zone:

Keep current country/zone

Update country/zone to:

State/Province/Region:

Keep current state/province/region

Update state/province/region to:

Subscribe to our newsletter?

Subscribe to our architect newsletter?

Subscribe to our industry email notices?

By subscribing to this email, we may send you content based on your previous topic interests. See our privacy notice for details.

You will be sent an email to validate the new email address. This pop-up will close itself in a few moments.

We notice you're using an ad blocker

We understand why you use ad blockers. However to keep InfoQ free we need your support. InfoQ will not provide your data to third parties without individual opt-in consent. We only work with advertisers relevant to our readers. Please consider whitelisting us.