Chapter 3. CayenneModeler Application

Table of Contents

Working with Mapping Projects
Reverse Engineering Database
Generating Database Schema
Migrations
Generating Java Classes
Modeling Inheritance
Modeling Generic Persistent Classes
Mapping ObjAttributes to Custom Classes
Modeling Primary Key Generation Strategy

Working with Mapping Projects

Reverse Engineering Database

Generating Database Schema

Migrations

Generating Java Classes

Modeling Inheritance

Modeling Generic Persistent Classes

Normally each ObjEntity is mapped to a specific Java class (such as Artist or Painting) that explicitly declare all entity properties as pairs of getters and setters. However Cayenne allows to map a completly generic class to any number of entities. The only expectation is that a generic class implements org.apache.cayenne.DataObject. So an ideal candidate for a generic class is CayenneDataObject, or some custom subclass of CayenneDataObject.

If you don't enter anything for Java Class of an ObjEntity, Cayenne assumes generic mapping and uses the following implicit rules to determine a class of a generic object. If DataMap "Custom Superclass" is set, runtime uses this class to instantiate new objects. If not, org.apache.cayenne.CayenneDataObject is used.

Class generation procedures (either done in the Modeler or with Ant or Maven) would skip entities that are mapped to CayenneDataObject explicitly or have no class mapping.

Mapping ObjAttributes to Custom Classes

Modeling Primary Key Generation Strategy