HHH-8904 documentation for build time bytecode enhancements
This commit is contained in:
parent
a39eeed257
commit
9fe3862e55
|
@ -1365,13 +1365,77 @@ hibernate.cache.use_structured_entries true</programlisting>
|
||||||
|
|
||||||
<section xml:id="entityentry-lookup-buildtime-instrument">
|
<section xml:id="entityentry-lookup-buildtime-instrument">
|
||||||
<title>Buildtime instrument</title>
|
<title>Buildtime instrument</title>
|
||||||
<para>Besides above two approaches, Hibernate also provides you the third choice, which is an ANT task (
|
<para>Besides above two approaches, Hibernate also provides you a
|
||||||
<classname>org.hibernate.tool.enhance.EnhancementTask</classname>) that can be used at build time to
|
third choice which is build time bytecode enhancement. Applications
|
||||||
instrument your entity classes with the required interfaces and methods.
|
should use enhanced entity classes annotated with either <classname>javax.persistence.Entity</classname>
|
||||||
|
or composite <classname>javax.persistence.Embeddable</classname>.
|
||||||
|
|
||||||
Meanwhile, the maven and gradle plugin are still under development and will be available soon.
|
<section xml:id="entityentry-lookup-buildtime-instrument-ant">
|
||||||
|
<title>Ant Task</title>
|
||||||
|
<para>To use the task <classname>org.hibernate.tool.enhance.EnhancementTask</classname>
|
||||||
|
define a taskdef and call the task as the example shows. This code uses a
|
||||||
|
pre defined classpathref and a property referencing the compiled classes
|
||||||
|
directory.
|
||||||
|
<programlisting role="XML"><taskdef name="enhance" classname="org.hibernate.tool.enhance.EnhancementTask" classpathref="enhancement.classpath" />
|
||||||
|
<enhance>
|
||||||
|
<fileset dir="${ejb-classes}/org/hibernate/auction/model" includes="**/*.class"/>
|
||||||
|
</enhance></programlisting>
|
||||||
|
</para>
|
||||||
|
<note>
|
||||||
|
<para>The EnhancementTask is intended as a replacement for <link linkend="performance-fetching-lazyproperties">InstrumentTask</link>. It is also incompatible so instrumented classels
|
||||||
|
will need building from source again.</para>
|
||||||
|
</note>
|
||||||
|
</section>
|
||||||
|
<section xml:id="entityentry-lookup-buildtime-instrument-maven">
|
||||||
|
<title>Maven Plugin</title>
|
||||||
|
<para>The Maven Plugin uses a Mojo descriptor to attach the Mojo to the compile
|
||||||
|
phase for your project.
|
||||||
|
<programlisting role="XML"><dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.javax.persistence</groupId>
|
||||||
|
<artifactId>hibernate-jpa-[SPEC-VERSION]-api</artifactId>
|
||||||
|
<version>[IMPL-VERSION]</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.hibernate.orm.tooling</groupId>
|
||||||
|
<artifactId>hibernate-enhance-maven-plugin</artifactId>
|
||||||
|
<version>VERSION</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>enhance</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin></programlisting>
|
||||||
|
</para>
|
||||||
|
</section>
|
||||||
|
<section xml:id="entityentry-lookup-buildtime-instrument-gradle">
|
||||||
|
<title>Gradle Plugin</title>
|
||||||
|
<para>The Gradle plugin adds an enhance task using the output directory of
|
||||||
|
the compile task as the source location of entity class files to enhance.
|
||||||
|
<programlisting>apply plugin: 'java'
|
||||||
|
apply plugin: 'maven'
|
||||||
|
apply plugin: 'enhance'
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath 'org.hibernate:hibernate-gradle-plugin:VERSION'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-[SPEC-VERSION]-api', version: '[IMPL-VERSION]'
|
||||||
|
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: 'VERSION'
|
||||||
|
}
|
||||||
|
</programlisting>
|
||||||
|
</para>
|
||||||
|
</section>
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
Loading…
Reference in New Issue