| <html><head> |
| <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> |
| <title>4. Generation of Canonical MetaModel classes</title><link rel="stylesheet" href="css/docbook.css" type="text/css"><base href="display"><meta name="generator" content="DocBook XSL Stylesheets V1.72.0"><link rel="start" href="manual.html" title="Apache OpenJPA 2.0 User's Guide"><link rel="up" href="jpa_overview_criteria.html" title="Chapter 11. JPA Criteria"><link rel="prev" href="ch13s03.html" title="3. Extension to Criteria API"><link rel="next" href="jpa_overview_sqlquery.html" title="Chapter 12. 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. Generation of Canonical MetaModel classes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch13s03.html">Prev</a> </td><th width="60%" align="center">Chapter 11. |
| JPA Criteria |
| </th><td width="20%" align="right"> <a accesskey="n" href="jpa_overview_sqlquery.html">Next</a></td></tr></table><hr></div><div class="section" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e11088"></a>4. 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_.java</code>. |
| </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 type="disc"><li><p> |
| -Aopenjpa.log=TRACE|INFO|WARN|ERROR : The logging level. Default is <code class="code">WARN</code>. |
| </p></li><li><p> |
| -Aopenjpa.source=<n> : where <n> denotes the integral number for Java source |
| version of the generated code. Default is <code class="code">6</code>. |
| </p></li><li><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 a underscore character |
| (<code class="code">_</code>) to the original Java class name. |
| </p></li><li><p> |
| -Aopenjpa.header=<url> : 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 a OpenJPA proprietary text as comment block. |
| </p></li><li><p> |
| -Aout=dir : A directory in the local file system. The generated files will be written |
| <span class="emphasis"><em>relative</em></span> to this directory according to the package structure i.e. if <code class="code">dir</code> |
| is specified as <code class="code">/myproject/generated-src</code> then the generated source code will be |
| written to <code class="code">/myproject/generated-src/mypackage/MyEntity_.java</code>. |
| If this option is not specified, then an attempt will be made to write the generated source file |
| in the same directory of the source code of original class <code class="code">mypackage.MyEntity</code>. |
| The source code location for <code class="code">mypackage.MyEntity</code> can only be determined for Sun JDK6 |
| and when <code class="code">tools.jar</code> being available to the compiler classpath. If the source code |
| location for the original class can not be determined, and the option is not specified, then the |
| generated source code is written relative to the current directory according to the package structure. |
| </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> </td><td width="20%" align="center"><a accesskey="u" href="jpa_overview_criteria.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="jpa_overview_sqlquery.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">3. Extension to Criteria API </td><td width="20%" align="center"><a accesskey="h" href="manual.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 12. |
| SQL Queries |
| </td></tr></table></div></body></html> |