Author: hardy.ferentschik
Date: 2010-03-10 09:28:56 -0500 (Wed, 10 Mar 2010)
New Revision: 18959
Modified:
jpamodelgen/trunk/readme.txt
jpamodelgen/trunk/src/main/docbook/en-US/master.xml
Log:
METAGEN-26 Updated readme and docbook sources
Modified: jpamodelgen/trunk/readme.txt
===================================================================
--- jpamodelgen/trunk/readme.txt 2010-03-10 13:21:46 UTC (rev 18958)
+++ jpamodelgen/trunk/readme.txt 2010-03-10 14:28:56 UTC (rev 18959)
@@ -1,65 +1,45 @@
- JPA Model Generator
+ Hibernate JPA2 Metamodel Generator
What is it?
-----------
This is a Java 6 annotation processor generating meta model classes for the JPA 2
criteria queries.
- The processor (JPAMetaModelEntityProcessor) processes all classes annotated with
@Entity, as well as
- entities mapped in /META-INF/orm.xml and mapping files specified in persistence.xml.
+ The processor (JPAMetaModelEntityProcessor) processes all classes annotated with
@Entity, @MappedSuperclass
+ or @Embeddable, as well as entities mapped in /META-INF/orm.xml and mapping files
specified in persistence.xml.
- Status
- ------
-
- This is an alpha release of the annotation processor. The implemented functionality
includes:
- - full support for annotations honoring the access type (v2.0)
- - support for persistence.xml, orm.xml and <mapping-file>
- - tests (both via compilation failure and regular assertion failure)
-
-
System Requirements
-------------------
JDK 1.6 or above.
+
+
+ Documentation
+ -------------
+
http://docs.jboss.org/hibernate/stable/jpamodelgen/reference/en-US/
- Issues
- ------
- See issues.txt
+ Licensing
+ ---------
+ Please see the file called license.txt
- Using JPA Model Generator
- -------------------------
- - Copy jpamodelgen-*.jar together will all jar files from lib into the classpath of
your application.
- The jpamodelgen jar file contains a service file
(/META-INF/services/javax.annotation.processing.Processor)
- so that the annotation processor will automatically be executed during compilation.
- You can also explicitly specify the processor using the -processor flag:
- > javac -cp <myclasspath> -d <target> -sourcepath <sources>
-processor org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
+ Resources
+ ---------
+ Home Page:
http://www.hibernate.org/
+ Mailing Lists:
http://www.hibernate.org/20.html
+ Source Code:
http://anonsvn.jboss.org/repos/hibernate/jpamodelgen/trunk/
+ Issue Tracking:
http://opensource.atlassian.com/projects/hibernate/browse/METAGEN
+
- * Maven
- This distribution contains a pom.xml file showing one of three possible ways to
integrate the processor in a maven project.
- You can just add
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
to the maven-compiler-plugin.
- This approach has, however, the shortcoming that messages from the annotation processor
are not displayed. This is a known
- issue. See also -
http://weblogs.java.net/blog/ss141213/archive/2007/11/my_maven_experi.html
- The second alternative is the maven-annotation-plugin
(
http://code.google.com/p/maven-annotation-plugin/). This approach
- hasn't been tested yet.
- Last but not least, you can use the maven-antrun-plugin to just run the annotation
processor and ignore the processor in
- in the maven-compiler-plugin via '-proc:none'. This is the approach chosen in
the POM for this project.
- * Ant
- Make sure the annotation processor and its dependencies are in the classpath. Due the
service file the processor will be
- automatically executed when the javac task executes.
- If not try adding <compilerarg value="-processor
org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor"/>
- * Idea
- Again, if in the classpath the JPAMetaModelEntityProcessor should execute
automatically. If not add the following under
- 'Compiler->Java Compiler': -target 1.6 -processor
org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor
- You can also turn of annotation processing via: -target 1.6 -proc:none
+
-
+
Modified: jpamodelgen/trunk/src/main/docbook/en-US/master.xml
===================================================================
--- jpamodelgen/trunk/src/main/docbook/en-US/master.xml 2010-03-10 13:21:46 UTC (rev
18958)
+++ jpamodelgen/trunk/src/main/docbook/en-US/master.xml 2010-03-10 14:28:56 UTC (rev
18959)
@@ -19,6 +19,7 @@
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY version "WORKING">
+<!ENTITY today "TODAY">
<!ENTITY copyrightYear "2010">
<!ENTITY copyrightHolder "Red Hat Inc.">
<!ENTITY jpa2Ref '<citation><xref
linkend="JPA2"/></citation>'>
@@ -26,20 +27,26 @@
]>
<book lang="en">
<bookinfo>
- <title>Hibernate Metamodel Generator</title>
- <subtitle>JPA 2 Static Metamodel Annotation Processor</subtitle>
+ <title>Hibernate JPA2 Metamodel Generator</title>
<subtitle>Reference Guide</subtitle>
<releaseinfo>&version;</releaseinfo>
+ <pubdate>&today;</pubdate>
<productnumber>&version;</productnumber>
<copyright>
<year>©rightYear;</year>
<holder>©rightHolder;</holder>
</copyright>
+ <authorgroup>
+ <author>
+ <firstname>Hardy</firstname>
+ <surname>Ferentschik</surname>
+ </author>
+ </authorgroup>
</bookinfo>
<toc/>
<chapter id="introduction">
<title>Introduction</title>
- <section id="whatisit" revision="1">
+ <section id="whatisit">
<title>What is it about?</title>
<para>JPA 2 defines a new typesafe
<classname>Criteria</classname> API which allows criteria
queries to be constructed in a strongly-typed manner, using metamodel objects to
provide
@@ -51,7 +58,7 @@
<example id="jpa2-entity-example">
<title>JPA 2 annotated entities <classname>Order</classname>
and
<classname>Item</classname></title>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
@Entity
public class Order {
@Id
@@ -87,7 +94,7 @@
</example>
<example id="metamodel-class-example">
<title>Metamodel class
<classname>Order_</classname></title>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
@StaticMetamodel(Order.class)
public class Order_ {
public static volatile SingularAttribute<Order, Integer> id;
@@ -99,11 +106,12 @@
</example>
<example id="criteria-example">
<title>Typesafe citeria query</title>
- <programlisting>
+ <programlisting role="JAVA" language="JAVA">
CriteriaBuilder cb = entityManager.getCriteriaBuilder();
CriteriaQuery<Order> cq = cb.createQuery(Order.class);
SetJoin<Order, Item> itemNode = cq.from(Order.class).join(Order_.items);
cq.where( cb.equal(itemNode.get(Item_.id), 5 ) ).distinct(true);
+
</programlisting>
</example>
</section>
@@ -139,23 +147,24 @@
<para>For every persistent non-collection-valued attribute y declared
by class
<classname>X</classname>, where the type of y is
<classname>Y</classname>, the
metamodel class must contain a declaration as follows:
- <programlisting>public static volatile SingularAttribute<X,
Y> y;</programlisting></para>
+ </para>
+ <programlisting>public static volatile SingularAttribute<X,
Y> y;</programlisting>
</listitem>
<listitem>
<para>For every persistent collection-valued attribute z declared by
class
<classname>X</classname>, where the element type of z is
<classname>Z</classname>,
the metamodel class must contain a declaration as
follows:<itemizedlist>
<listitem>
- <para>if the collection type of z is java.util.Collection, then
- <programlisting>public static volatile
CollectionAttribute<X, Z> z;</programlisting></para>
+ <para>if the collection type of z is java.util.Collection,
then</para>
+ <programlisting>public static volatile
CollectionAttribute<X, Z> z;</programlisting>
</listitem>
<listitem>
- <para>if the collection type of z is java.util.Set, then
- <programlisting>public static volatile SetAttribute<X,
Z> z;</programlisting></para>
+ <para>if the collection type of z is java.util.Set,
then</para>
+ <programlisting>public static volatile SetAttribute<X,
Z> z;</programlisting>
</listitem>
<listitem>
- <para>if the collection type of z is java.util.List, then
- <programlisting>public static volatile ListAttribute<X,
Z> z;</programlisting></para>
+ <para>if the collection type of z is java.util.List,
then</para>
+ <programlisting>public static volatile ListAttribute<X,
Z> z;</programlisting>
</listitem>
<listitem>
<para>if the collection type of z is java.util.Map, then
@@ -177,14 +186,14 @@
linkend="maven-dependency"/>.</para>
<example id="maven-dependency">
<title>Maven dependency </title>
- <programlisting><dependency>
+ <programlisting role="XML"
language="XML"><dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>1.0.0</version>
</dependency></programlisting>
</example>
<para>Alternatively, a full distribution package can be downloaded from
<ulink
-
url="http://sourceforge.net/projects/hibernate">SourceForge&...
+
url="http://sourceforge.net/projects/hibernate/files/hibernate-jpamo...
<para>In most cases the annotation processor will automatically run provided
the processor jar is added to the classpath and a JDK 6 is used. This happens due
to <ulink
url="http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html#Service%...
@@ -197,7 +206,7 @@
</note></para>
<section>
<title>Usage from the command line</title>
- <section id="usage-ant" revision="1">
+ <section id="usage-ant">
<title>Usage with Ant</title>
<para>As mentioned before, the annotation processor will run automatically
each time the
Java compiler is called, provided the jar file is on the classpath. Sometimes,
however, it is
@@ -208,12 +217,12 @@
configured to just run annotation processing.</para>
<example id="javac-task-example">
<title>Javac Task configuration</title>
- <programlisting><javac srcdir="${src.dir}"
+ <programlisting role="XML"
language="XML"><javac srcdir="${src.dir}"
destdir="${target.dir}"
failonerror="false"
fork="true"
classpath="${classpath}">
- <emphasis role="bold"><compilerarg
value="-proc:only"/></emphasis>
+ <compilerarg value="-proc:only"/>
</javac></programlisting>
</example>
<para>The option <emphasis>-proc:only</emphasis> instructs the
compiler to just run the
@@ -224,27 +233,25 @@
relevant options can be specified.</para>
</tip>
</section>
- <section revision="1">
+ <section>
<title>Usage with Maven</title>
<para>There are several ways of running the annotation processor as part of
a Maven build.
Again, it will automatically run if you are using a JDK 6 compiler and the
annotation
processor jar is on the classpath. In case you have more than one annotation
processors on
your classpath you can explicitly pass the processor option to the compiler
plugin:</para>
- <para>
<example>
<title>Maven compiler plugin configuration - direct
execution</title>
- <programlisting><plugin>
+ <programlisting role="XML"
language="XML"><plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
- <emphasis
role="bold"><processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor></emphasis>
+
<processor>org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor</processor>
</compilerArguments>
</configuration>
</plugin></programlisting>
</example>
- </para>
<para>The maven-compiler-plugin approach has the disadvantage that the
maven compiler plugin
does currently not allow to specify multiple compiler arguments (<ulink
url="http://jira.codehaus.org/browse/MCOMPILER-62">MCOMPILER...>)
and that
@@ -254,12 +261,12 @@
linkend="disable-processing-maven-compiler-plugin"/>.</para>
<example id="disable-processing-maven-compiler-plugin">
<title>Maven compiler plugin configuration - indirect
execution</title>
- <programlisting><plugin>
+ <programlisting role="XML"
language="XML"><plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
- <emphasis
role="bold"><compilerArgument>-proc:none</compilerArgument></emphasis>
+ <compilerArgument>-proc:none</compilerArgument>
</configuration>
</plugin></programlisting>
</example>
@@ -271,8 +278,8 @@
url="http://www.jfrog.org/artifactory/plugins-releases">jfro...>)
can be used. The
configuration can be seen in <xref
linkend="maven-processor-plugin"/>.</para>
<example id="maven-processor-plugin">
- <title>Maven compiler plugin configuration with
maven-annotation-plugin</title>
- <programlisting><plugin>
+ <title>Configuration with maven-annotation-plugin</title>
+ <programlisting role="XML"
language="XML"><plugin>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<executions>