This page highlights the new features and changes introduced in 3.0 release, roughly corresponding to the latest released milestone. It is a high level overview and as such is by no means complete. Consult RELEASE-NOTES.txt file included in each release for the full list of changes.
(status: preview)
Cayenne 3.0 includes an in-progress partial implementation of a Java Persistence API specification compliant persistence provider, with support for POJO and JPA annotations. Provider can be used in a standalone mode, as well as a part of a J2EE container.
Currently implemented features:
Stopped supporting DerivedDbEntity - its functionality (aggregate queries) is achieved via EJBQL and other means.
(as of M4 there's no Modeler support)
Added a new mapping artifact - Embeddable, that allows to map composite objects to a single table.
(as of M4 there's no Modeler support)
Just like with "flattened" relationships, now there is a way to map an ObjAttribute that spans one or more DbRelationships and is mapped to a column of a joined table.
DataObjects are now allowed to have primitive properties, such as int, boolean, etc. Also Cayenne can now persist the following extra simple property types: java.util.Calendar, java.math.BigInteger, java.io.Serializable, char[], java.lang.Character, java.lang.Character[], java.lang.Byte[].
In addition to mapping a to-many relationship as a List, Cayenne now supports to-many Maps (keyed by target object pk, or an arbitrary unique property), Sets and generic Collections. Note that relationship maps is the only conceptually new type of relationships. Collection and Set are not that different from the earlier List behavior (that was a Collection, and just like Set ensured uniqueness of its objects).
In addition to vanilla Java enums, Cayenne allows enums to provide a custom database value for each enumerated instance by implementing org.apache.cayenne.ExtendedEnumeration. This way a persistent value doesn't have to be tied to the enum Java name or position.
Changed DbAttribute "precision" property to "scale" (as it meant scale all along) and added a separate "precision" attribute to track precision.
Many of the improvements below were done to support the JPA provider, still Cayenne applications can take advantage from all of these things without using JPA.
Cayenne now requires Java 5 or newer to run. This allowed us to start using generics, enums and other Java 5 features.
While you can still use DataContext directly, we encourage you to avoid direct dependency on DataContext throughout your code, and instead use org.apache.cayenne.ObjectContext interface. E.g.:
ObjectContext context = DataContext.createDataContext();
This protects your code from the evolution of the underlying implementation, allows you to customize context behavior by using interface wrappers. There are plans to update all Cayenne API to return ObjectContext everywhere DataContext might be returned.
(as of M3 there's no Modeler support)
Never mind the "EJB" in the name. EJBQL queries are a powerful object query mechanism borrowed from the JPA specification and added to Cayenne API. EJBQLQuery is a first-class citizen, just like SelectQuery.
Just like EJBQL, lifecycle callbacks is a JPA-inspired feature that allows to perform custom operations at certain points in the object lifecycle. For more details see this page.
Implemented DataContext.rollbackChangesLocally(). This was missing in 2.0, limiting the operation of the nested DataContexts.
(status: preview)
Now object validation works the same way on the ROP client as it did on the server.
The Modeler underwent significant changes with the goal to improve usability and look-and-feel.
Cayenne no longer has a Log4J dependency. Instead it uses Jakarta commons-logging, as described here. Note that 2.0 Log4J configurations should continue to work, although now it is a user responsibility to bootstrap Log4J - Cayenne will no longer do it for you. E.g. you can do this on startup:
org.apache.log4j.PropertyConfigurator.configure("cayenne-log.properties");