Title: Guide to 1.1 Features
Cayenne version 1.1 introduces a large number of new features and enhancements over 1.0. This chapter lists most of them, providing the links to more detailed information about each feature.
"cayenne.xml" and "*.map.xml" file formats were updated to support new features. 1.1 DTD files are located here:
Upgrade Warning Saving projects with CayenneModeler v.1.1 will render them uneditable with CayenneModeler v.1.0. |
Cayenne now provides a way to share its object cache between DataContexts in the same JVM and across JVMs. The following chapters in the user guide describe this feature:
ObjAttributes and ObjRelationships can be marked to be used for "optimistic" locking. If an corresponding columns of the underlying database row are externally modified, an attempt to save an object results in OptimisticLockingException.
DataObjectUtils is an often requested feature for easy retrieval of an object primary key, or locating an object for a known key. It works in a generic way for any type of DataObjects, even if a PK is not a class property.
Cayenne now supports entity inheritance for entities rooted in the same DB table (single table inheritance).
Data Views is a completely new addition to Cayenne. This is a framework and a Swing modeler tool to quickly build Swing applications based on Cayenne.
Cayenne now includes a generic Event Package "org.objectstyle.cayenne.event" for registering listeners and sending events, both locally and remotely. It supports both blocking and non-blocking listeners and dispatches. Supported remote transports include JMS and JavaGroups.
DataContext now performs validation of DataObjects before committing them. There is a set of default validation checks being executed, based on the DataMap information. Developers can override DataObject validation methods to provide custom validation checks.
Original implementation was submitted by Fabricio Voznika.
There is a new expression parser that allows creation of complex expressions from strings ("Expression.fromString(..)"). This greatly reduces the amount of code needed to build an expression.
In-memory evaluation API is improved, and now supports both boolean conditions (via "Expression.match" method) and generic expressions evaluation (via "Expression.evaluate" method), it also includes support for arithmetic operations.
SQLTemplate replaces SqlSelectQuery and SqlModifyQuery and is a scriptable parameterized raw SQL query. It supports DataObjects and other features declared in GenericSelectQuery interface.
DataContext now provides simple API to run SelectQuery, SQLTemplate and ProcedureQuery by name if such queries are mapped via CayenneModeler:
DataDomain now provides a shared mapping namespace. This means that all mapping objects can reference other mapping objects outside their DataMaps. For example two DbEntities can be located in different DataMaps and still have relationships to each other.
Temporary limitation of the shared mapping namespace is that Queries stored in the DataMap can't have a "root" from a different DataMap.
ObjEntities now can hold a qualifier expression that is automatically appended to any query qualifiers, thus creating a global data filter for a given entity. This feature is used for inheritance mapping, however it has nothing to do with inheritance as such and can be used all by itself.
Cayenne now supports container-managed transactions. As a result it can be used inside EJBs out of the box. It also allows a high degree of transactions customization. The following user guide chapter explains Transactions design and behavior in details:
Cayenne features new database adapters:
Added support for one-to-one relationships between PK and non-PK columns of related tables. In the past this could only be modeled as one-to-many. CayenneModeler will create UNIQUE constraint for a non-PK columns during schema generation.
Queries are made first-class mapping objects. They can be modeled in CayenneModeler and stored in DataMaps. Application code can then reuse such queries.
The following is an incomplete list of enhancements: new professional look and feel, preference engine, reenginnering of stored procedures, local DataSources, configurable locations of JDBC drivers, custom class generation templates, etc. A number of Modeler tasks and dialogs have been redesigned and improved to be more user-friendly and consistent.
Also CayenneModeler supports mapping of all the new 1.1 framework features, such as DataMap queries, cache synchronization configuration, etc.