blob: 0ebacd4d570f4c01b2a568ae1e0fc8edb8725a4a [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title xmlns:d="http://docbook.org/ns/docbook">Chapter&nbsp;3.&nbsp;CayenneModeler Application</title><link rel="stylesheet" type="text/css" href="css/cayenne-doc.css"><meta xmlns:d="http://docbook.org/ns/docbook" name="keywords" content="Cayenne 3.1 documentation"><meta xmlns:d="http://docbook.org/ns/docbook" name="description" content="User documentation for Apache Cayenne version 3.1"><link rel="home" href="index.html" title="Cayenne Guide"><link rel="up" href="cayenne-guide-part1.html" title="Part&nbsp;I.&nbsp;Object Relational Mapping with Cayenne"><link rel="prev" href="cayenne-mapping-structure.html" title="Chapter&nbsp;2.&nbsp;Cayenne Mapping Structure"><link rel="next" href="cayenne-guide-part2.html" title="Part&nbsp;II.&nbsp;Cayenne Framework"><script xmlns:d="http://docbook.org/ns/docbook" type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-7036673-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div xmlns:d="http://docbook.org/ns/docbook" class="navheader"><table width="100%" summary="Navigation header"><tr><th class="versioninfo">v.3.1 (3.1)</th><th align="center">Chapter&nbsp;3.&nbsp;CayenneModeler Application</th><th></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="cayenne-mapping-structure.html">Prev</a>&nbsp;</td><th width="60%" align="center"><a accesskey="u" href="cayenne-guide-part1.html">Part&nbsp;I.&nbsp;Object Relational Mapping with Cayenne</a></th><td width="20%" align="right">&nbsp;<a accesskey="n" href="cayenne-guide-part2.html">Next</a></td></tr></table><hr></div><div class="chapter" title="Chapter&nbsp;3.&nbsp;CayenneModeler Application"><div class="titlepage"><div><div><h2 class="title"><a name="cayennemodeler-application"></a>Chapter&nbsp;3.&nbsp;CayenneModeler Application</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="cayennemodeler-application.html#working-with-mapping-projects">Working with Mapping Projects</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#reverse-engineering-database">Reverse Engineering Database</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#generating-database-schema">Generating Database Schema</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#migrations">Migrations</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#generating-java-classes">Generating Java Classes</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#modeling-inheritance">Modeling Inheritance</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#modeling-generic-persistence-classes">Modeling Generic Persistent Classes</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#mapping-objattributes-to-custom-classes">Mapping ObjAttributes to Custom Classes</a></span></dt><dt><span class="section"><a href="cayennemodeler-application.html#modeling-pk-generation-strategy">Modeling Primary Key Generation Strategy</a></span></dt></dl></div><div class="section" title="Working with Mapping Projects"><div class="titlepage"><div><div><h2 class="title"><a name="working-with-mapping-projects"></a>Working with Mapping Projects</h2></div></div></div></div><div class="section" title="Reverse Engineering Database"><div class="titlepage"><div><div><h2 class="title"><a name="reverse-engineering-database"></a>Reverse Engineering Database</h2></div></div></div></div><div class="section" title="Generating Database Schema"><div class="titlepage"><div><div><h2 class="title"><a name="generating-database-schema"></a>Generating Database Schema</h2></div></div></div></div><div class="section" title="Migrations"><div class="titlepage"><div><div><h2 class="title"><a name="migrations"></a>Migrations</h2></div></div></div></div><div class="section" title="Generating Java Classes"><div class="titlepage"><div><div><h2 class="title"><a name="generating-java-classes"></a>Generating Java Classes</h2></div></div></div></div><div class="section" title="Modeling Inheritance"><div class="titlepage"><div><div><h2 class="title"><a name="modeling-inheritance"></a>Modeling Inheritance</h2></div></div></div></div><div class="section" title="Modeling Generic Persistent Classes"><div class="titlepage"><div><div><h2 class="title"><a name="modeling-generic-persistence-classes"></a>Modeling Generic Persistent Classes</h2></div></div></div><p>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
<span class="emphasis"><em>org.apache.cayenne.DataObject</em></span>. So an ideal candidate for a
generic class is CayenneDataObject, or some custom subclass of CayenneDataObject.</p><p>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.</p><p>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.</p></div><div class="section" title="Mapping ObjAttributes to Custom Classes"><div class="titlepage"><div><div><h2 class="title"><a name="mapping-objattributes-to-custom-classes"></a>Mapping ObjAttributes to Custom Classes</h2></div></div></div></div><div class="section" title="Modeling Primary Key Generation Strategy"><div class="titlepage"><div><div><h2 class="title"><a name="modeling-pk-generation-strategy"></a>Modeling Primary Key Generation Strategy</h2></div></div></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="cayenne-mapping-structure.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="cayenne-guide-part1.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="cayenne-guide-part2.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter&nbsp;2.&nbsp;Cayenne Mapping Structure&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Part&nbsp;II.&nbsp;Cayenne Framework</td></tr></table></div></body></html>