blob: dad174a40c503567076521fcb5dff3171f1ddba3 [file] [log] [blame]
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>4.&nbsp;Generation of Canonical MetaModel classes</title><base href="display"><link rel="stylesheet" type="text/css" href="css/docbook.css"><meta name="generator" content="DocBook XSL-NS Stylesheets V1.76.1"><link rel="home" href="manual.html" title="Apache OpenJPA 2.4 User's Guide"><link rel="up" href="jpa_overview_criteria.html" title="Chapter&nbsp;11.&nbsp; JPA Criteria"><link rel="prev" href="ch13s03.html" title="3.&nbsp;Extension to Criteria API"><link rel="next" href="jpa_overview_sqlquery.html" title="Chapter&nbsp;12.&nbsp; SQL Queries"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">4.&nbsp;Generation of Canonical MetaModel classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch13s03.html">Prev</a>&nbsp;</td><th width="60%" align="center">Chapter&nbsp;11.&nbsp;
JPA Criteria
</th><td width="20%" align="right">&nbsp;<a accesskey="n" href="jpa_overview_sqlquery.html">Next</a></td></tr></table><hr></div><div class="section" title="4.&nbsp;Generation of Canonical MetaModel classes"><div class="titlepage"><div><div><h2 class="title" style="clear: both" id="d5e5275">4.&nbsp;Generation of Canonical MetaModel classes</h2></div></div></div>
<p>
Annotation processing tool generates source code for a metamodel class given
the annotated source code of persistent entity.
This tool is invoked during compilation for JDK6 compiler if OpenJPA and JPA
libraries are specified in the compiler <code class="code">-classpath</code> option <span class="emphasis"><em>and</em></span>
Annotation processor option <code class="code">-Aopenjpa.metamodel=true</code> is specified.
</p><pre class="programlisting">
$ javac -classpath path/to/openjpa-all.jar -Aopenjpa.metamodel=true mypackage/MyEntity.java
</pre><p>
will generate source code for canonical meta-model class <code class="code">mypackage.MyEntity_</code>.
The source code is generated relative to the directory specified in <code class="code">-s</code> option
of <code class="code">javac</code> compiler and defaulted to the current directory.
</p>
<p>
The Annotation Processor recognizes the following options specified in the command-line with <code class="code">-A</code>
(none of them are mandatory).
</p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
<p>
-Aopenjpa.log=TRACE|INFO|WARN|ERROR : The logging level. Default is <code class="code">WARN</code>.
</p>
</li><li class="listitem">
<p>
-Aopenjpa.source=&lt;n&gt; : where &lt;n&gt; denotes the integral number for Java source
version of the generated code. Default is <code class="code">6</code>.
</p>
</li><li class="listitem">
<p>
-Aopenjpa.naming=class name : fully-qualified name of a class implementing
<code class="code">org.apache.openjpa.meta.MetaDataFactory</code> that determines
the name of a meta-class given the name of the original persistent Java entity class. Defaults to
<code class="code">org.apache.openjpa.persistence.PersistenceMetaDataFactory</code> which appends an underscore character
(<code class="code">_</code>) to the original Java class name.
</p>
</li><li class="listitem">
<p>
-Aopenjpa.header=&lt;url&gt; : A url whose content will appear as comment header to the generated file(s).
Recognizes special value <code class="code">ASL</code> for Apache Source License header as comment.
By default, adds an OpenJPA proprietary text as comment block.
</p>
</li></ul></div><p>
</p>
</div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch13s03.html">Prev</a>&nbsp;</td><td width="20%" align="center"><a accesskey="u" href="jpa_overview_criteria.html">Up</a></td><td width="40%" align="right">&nbsp;<a accesskey="n" href="jpa_overview_sqlquery.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3.&nbsp;Extension to Criteria API&nbsp;</td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top">&nbsp;Chapter&nbsp;12.&nbsp;
SQL Queries
</td></tr></table></div></body></html>