CayenneModeler supports executing commands via its main menu, a button toolbar and contextual menus that open on right-click. All of the toolbar buttons have corresponding items in the menu that perform the exact same operation (plus there are operations that are available via the menu only). If an item or a button action can not be performed in a given context an item is visually disabled.
There is a main toolbar shown below, and a number of object-specific toolbars.
The following is a quick reference of the toolbar button functions.
Cayenne Project is a logical deployment unit, that consists of a main project file (called cayenne.xml) and zero or more DataNode (*.driver.xml) and DataMap (*.map.xml) XML files. Currently CayenneModeler supports a single project per running Modeler instance, however multiple instances of Modeler can be started to edit multiple projects at the same time.
Each DataDomain is an abstraction of a logical data source, possibly spreading multiple physical databases. cayenne.xml file lists DataDomains present in the project. Most projects will contain only a single domain. DataDomain button creates a new DataDomain in the currently open project.
DataNode is an object that corresponds to a single physical data source, normally a database. Currently there are two types of DataNodes:
- Based on DataSource obtained via JNDI from the container (e.g. a WebLogic or Tomcat server).
- Based on JDBC driver. In this case Cayenne provides its own connection pooling and other functions expected from a DataSource.
DataNode references zero or more DataMaps defined under DataDomain.
DataMap is a collection of Object/Relational mapping information linking Java object layer with the relational database. DataMaps are created within DataDomains and can be later linked to DataNodes.
There are two types of entities in Cayenne DataMaps: ObjEntities, reflecting the structure of the object layer, and DbEntities that describe database tables and views. In other words, ObjEntity is a descriptor of a persistent Java class, and DbEntity is a descriptor of a database table or view. Each ObjEntity is based on a DbEntity, but there can be DbEntities that do not have a corresponding ObjEntity.
Embeddables are the special kind of mapping objects that allow to map parts of a DB table as a separate object, allowing to use composition within entities.
Procedure is a descriptor of a database stored procedure. It can be created in the modeler and later invoked using ProcedureQuery. Note that not all databases support stored procedures.
Cayenne allows to store queries in the DataMap. There are 4 types of Cayenne queries that can be created in the Modeler - object select query, raw SQL query, procedure query and EJBQL query.