From ab4c9258afdd23d99f2e0c7e698f9f95ad17beb8 Mon Sep 17 00:00:00 2001 From: Vlad Mihalcea Date: Tue, 23 Feb 2016 16:26:50 +0200 Subject: [PATCH] HHH-10552 - Gradle plugin section of Bytecode Enhancement should specify how to apply the plugin --- .../topical/bytecode/BytecodeEnhancement.adoc | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/documentation/src/main/asciidoc/topical/bytecode/BytecodeEnhancement.adoc b/documentation/src/main/asciidoc/topical/bytecode/BytecodeEnhancement.adoc index d39aa37c57..7ea2b0fcf2 100644 --- a/documentation/src/main/asciidoc/topical/bytecode/BytecodeEnhancement.adoc +++ b/documentation/src/main/asciidoc/topical/bytecode/BytecodeEnhancement.adoc @@ -39,7 +39,6 @@ normal build cycle of that domain model. Gradle, Ant and Maven are all supporte of this approach is that the enhanced classes are what gets added to the jar and can then be used on both sides of serialization. - === Gradle Plugin Hibernate provides a Gradle plugin that is capable of providing build-time enhancement of the domain model as they are @@ -50,20 +49,23 @@ compiled as part of a Gradle build. To use the plugin a project would first nee ==== [source, GROOVY] ---- -ext { - hibernateVersion = 'hibernate-version-you-want' -} buildscript { - dependencies { - classpath "org.hibernate:hibernate-gradle-plugin:$hibernateVersion" - } + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath "org.hibernate:hibernate-gradle-plugin:5.1.0.Final" + } } + +apply plugin: 'org.hibernate.orm' ---- ==== -At the moment there is not much to configure with regard to the Enhancer, but what is configurable is exposed -through a DSL extension registered. By default enhancement will not be done (in preparation for when this -Gradle plugin offers additional capabilities). To enable it you must configure the following DSL extension: +At the moment there is not much to configure with regard to the Enhancer, but what is configurable is exposed through a DSL extension registered. +By default, enhancement will not be done (in preparation for when this Gradle plugin offers additional capabilities). +To enable it you must configure the following DSL extension: [[gradle-plugin-apply-example]] .Apply the plugin @@ -71,9 +73,12 @@ Gradle plugin offers additional capabilities). To enable it you must configure [source, GROOVY] ---- hibernate { - enhance { - // any configuration goes here - } + enhance { + enableLazyInitialization= true + enableDirtyTracking = true + enableAssociationManagement = true + enableExtendedEnhancement = false + } } ---- ==== @@ -89,10 +94,6 @@ Once enhancement overall is enabled, the default for the first 3 properties is ` default, as it can potentially trigger enhancement of code outside the entities, and also because it assumes that all the target entities are enhanced, which may not always be the case. - -=== Ant Task - - === Maven Plugin The Hibernate Maven plugin provides a convenient way to enhance the domain model at build-time when using Maven as the @@ -147,4 +148,7 @@ already in use. The XML snippet below is an example of how to declare and config ---- ==== +=== Ant Task + +