|
6 | 6 | :example-dir-metamodelgen-generated: {testing-project-dir}/target/generated/sources/annotationProcessor/java/main/org/hibernate/testing/orm/domain/userguide
|
7 | 7 | :core-project-dir: {root-project-dir}/hibernate-core
|
8 | 8 | :toolingTestsDir: {core-project-dir}/src/test/java/org/hibernate/orm/test/tooling
|
9 |
| - |
10 |
| -Jakarta Persistence defines a typesafe Criteria API which allows `Criteria` queries to be constructed in a |
11 |
| -strongly-typed manner, utilizing so-called static metamodel classes. For developers, it is important that |
12 |
| -the task of the metamodel generation can be automated. Hibernate Static Metamodel Generator is an annotation |
13 |
| -processor based on https://jcp.org/en/jsr/detail?id=269[JSR_269] with the task of creating Jakarta Persistence |
14 |
| -static metamodel classes. |
15 |
| - |
16 |
| -See <<criteria>> for discussion of Jakarta Persistence criteria queries. |
17 |
| - |
18 |
| -The Hibernate Static Metamodel Generator is defined by the published `org.hibernate.orm:hibernate-jpamodelgen` |
19 |
| -artifact. As it is defined as an |
20 |
| -https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-082C33A5-CBCA-471A-845E-E77F79B7B049[annotation processor], |
21 |
| -it is usable anytime `javac` is used. See the tool-specific discussions (<<tooling-gradle-modelgen,Gradle>>, <<tooling-maven-modelgen,Maven>> |
22 |
| -and <<tooling-ant,Ant>>) for details on integrating the generator into those environments. |
23 |
| - |
24 |
| -NOTE:: The fully qualified name of the processor class is `org.hibernate.jpamodelgen.JPAMetaModelEntityProcessor`. |
25 |
| - |
26 |
| -[TIP] |
| 9 | +:ann-proc: https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-082C33A5-CBCA-471A-845E-E77F79B7B049__GUID-3FA757C8-B67B-46BC-AEF9-7C3FFB126A93 |
| 10 | +:ann-proc-path: https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-214E175F-0F06-4CDC-B511-5BA469955F5A |
| 11 | +:ann-proc-options: https://docs.oracle.com/en/java/javase/11/tools/javac.html#GUID-AEEC9F07-CB49-4E96-8BC7-BCC2C7F725C9__GUID-6CC814A4-8A29-434A-B7E1-DF8234784E7C |
| 12 | +:intg-guide: https://docs.jboss.org/hibernate/orm/6.3/introduction/html_single/Hibernate_Introduction.html#generator |
| 13 | + |
| 14 | +Jakarta Persistence defines a typesafe Criteria API which allows <<criteria,`Criteria`>> |
| 15 | +queries to be constructed in a strongly-typed manner, utilizing so-called static metamodel |
| 16 | +classes. The Hibernate Static Metamodel Generator, available via the published |
| 17 | +`org.hibernate.orm:hibernate-jpamodelgen` artifact, is an link:{ann-proc}[annotation processor] |
| 18 | +used to generate these static metamodel classes. |
| 19 | + |
| 20 | +[NOTE] |
27 | 21 | ====
|
28 |
| -The `javac` option _-proc:only_ instructs the compiler to just run the annotation processing. |
29 |
| -You can also disable annotation processing by specifying _-proc:none_. |
| 22 | +The Hibernate Static Metamodel Generator has many additional capabilities beyond static metamodel |
| 23 | +class generation. See the link:{intg-guide}[Introduction Guide] for a complete discussion of its |
| 24 | +capabilities. The rest of the discussion here is limited to the Jakarta Persistence static metamodel. |
30 | 25 |
|
31 |
| -Run `'javac -help'` to see which other annotation processor relevant options can be specified. |
| 26 | +The generator is expected to be run using the `javac` link:{ann-proc-path}[-processorpath] option. |
| 27 | +See the tool-specific discussions (<<tooling-gradle-modelgen,Gradle>>, <<tooling-maven-modelgen,Maven>> |
| 28 | +and <<tooling-ant,Ant>>) for details on integrating the generator into those environments. |
32 | 29 | ====
|
33 | 30 |
|
| 31 | +[[tooling-modelgen-classes]] |
| 32 | +==== Metamodel classes |
34 | 33 |
|
35 | 34 | The structure of the metamodel classes is described in the Jakarta Persistence
|
36 | 35 | specification, but for completeness the definition is repeated in the following
|
@@ -108,3 +107,18 @@ include::{toolingTestsDir}/modelgen/ModelGenTests.java[tags=tooling-modelgen-usa
|
108 | 107 | ----
|
109 | 108 | ====
|
110 | 109 |
|
| 110 | +[[tooling-modelgen-options]] |
| 111 | +==== Generation Options |
| 112 | + |
| 113 | +The Hibernate Static Metamodel Generator accepts a number of configuration options, which are specified as |
| 114 | +part of the `javac` execution using standard link:{ann-proc-options}[-A] options - |
| 115 | + |
| 116 | +`-Adebug=[true|false]`:: Enables debug logging from the generator. |
| 117 | +`-AfullyAnnotationConfigured=[true|false]`:: Controls whether `orm.xml` mapping should be considered. |
| 118 | +`-ApersistenceXml=[path]`:: Specifies the path to the `persistence.xml` file. |
| 119 | +`-AormXml=[path]`:: Specifies the path to an `orm.xml` file. |
| 120 | +`-AlazyXmlParsing=[true|false]`:: Controls whether the processor should attempt to determine whether any `orm.xml` files have changed. |
| 121 | +`-AaddGeneratedAnnotation=[true|false]`:: Controls whether the processor should add `@jakarta.annotation.Generated` to the generated classes. |
| 122 | +`-addGenerationDate=[true|false]`:: Controls whether the processor should add `@jakarta.annotation.Generated#date`. |
| 123 | +`-addSuppressWarningsAnnotation=[true|false]`:: Controls whether the processor should add `@SuppressWarnings({"deprecation","rawtypes"})` to the generated classes. |
| 124 | + |
0 commit comments