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 -classpath
option and
Annotation processor option -Aopenjpa.metamodel=true
is specified.
$ javac -classpath path/to/openjpa-all.jar -Aopenjpa.metamodel=true mypackage/MyEntity.java
will generate source code for canonical meta-model class mypackage.MyEntity_.java
.
The Annotation Processor recognizes the following options specified in the command-line with -A
(none of them are mandatory).
-Aopenjpa.log=TRACE|INFO|WARN|ERROR : The logging level. Default is WARN
.
-Aopenjpa.source=<n> : where <n> denotes the integral number for Java source
version of the generated code. Default is 6
.
-Aopenjpa.naming=class name : fully-qualified name of a class implementing
org.apache.openjpa.meta.MetaDataFactory
that determines
the name of a meta-class given the name of the original persistent Java entity class. Defaults to
org.apache.openjpa.persistence.PersistenceMetaDataFactory
which appends a underscore character
(_
) to the original Java class name.
-Aopenjpa.header=<url> : A url whose content will appear as comment header to the generated file(s).
Recognizes special value ASL
for Apache Source License header as comment.
By default, adds a OpenJPA proprietary text as comment block.
-Aout=dir : A directory in the local file system. The generated files will be written
relative to this directory according to the package structure i.e. if dir
is specified as /myproject/generated-src
then the generated source code will be
written to /myproject/generated-src/mypackage/MyEntity_.java
.
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 mypackage.MyEntity
.
The source code location for mypackage.MyEntity
can only be determined for Sun JDK6
and when tools.jar
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.