Skip to content

Commit c7a23b0

Browse files
marko-bekhtaDavideD
authored andcommitted
[#2836] Use ORM version variable in the doc
1 parent dcac681 commit c7a23b0

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

documentation/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,22 @@ def renderReferenceDocumentationTask = tasks.register( 'renderReferenceDocumenta
117117
outputDir = project.layout.buildDirectory.dir( "asciidoc/reference/html_single" ).get().asFile
118118
options logDocuments: true
119119

120+
def ormMinorVersion = libs.versions.hibernateOrmVersion.map { v ->
121+
def matcher = v =~ /\d+\.\d+/
122+
if (matcher.find()) {
123+
return matcher.group()
124+
} else {
125+
throw new IllegalArgumentException("Cannot parse the version of Hibernate ORM from '" + v + "' string.")
126+
}
127+
}
128+
120129
attributes icons: 'font',
121130
'source-highlighter': 'rouge',
122131
experimental: true,
123132
linkcss: true,
124133
majorMinorVersion: project.projectVersion.family,
125134
fullVersion: project.version.toString(),
135+
ormMinorVersion: ormMinorVersion.get(),
126136
docinfo: 'private'
127137
}
128138

documentation/src/main/asciidoc/reference/introduction.adoc

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ implementation of JPA. If you've never used JPA before, that's OK, but you
2424
might need to refer to the following sources of information at some points
2525
in this text:
2626

27-
- the http://hibernate.org/orm/documentation/5.6/[documentation for Hibernate ORM],
28-
- the https://jcp.org/aboutJava/communityprocess/mrel/jsr338/index.html[JPA 2.2 specification], or
27+
- the http://hibernate.org/orm/documentation/{ormMinorVersion}/[documentation for Hibernate ORM],
28+
- the https://jakarta.ee/specifications/persistence/3.1/jakarta-persistence-spec-3.1[Jakarta Persistence 3.1 specification], or
2929
- https://www.manning.com/books/java-persistence-with-hibernate-second-edition[Java Persistence with Hibernate],
3030
the latest edition of the book originally titled _Hibernate in Action_.
3131

@@ -77,7 +77,7 @@ You don't need to depend on the JDBC driver for your database.
7777
=== Optional dependencies
7878

7979
:slf4j: http://www.slf4j.org/
80-
:enhancer: https://docs.hibernate.org/orm/5.4/topical/html_single/bytecode/BytecodeEnhancement.html
80+
:enhancer: https://docs.hibernate.org/orm/{ormMinorVersion}/topical/html_single/bytecode/
8181

8282
Optionally, you might also add any of the following additional features:
8383

@@ -103,7 +103,7 @@ There's an example {build}[Gradle build] included in the example program.
103103
=== Basic configuration
104104

105105
:xml: https://github.com/hibernate/hibernate-reactive/blob/main/examples/session-example/src/main/resources/META-INF/persistence.xml
106-
:configuration-properties: https://docs.hibernate.org/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#configurations
106+
:configuration-properties: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#configurations
107107

108108

109109
Hibernate Reactive is configured via the standard JPA `persistence.xml`
@@ -333,7 +333,7 @@ of framework code.
333333

334334
=== Mapping entity classes
335335

336-
:mapping-annotations: https://docs.hibernate.org/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#annotations
336+
:mapping-annotations: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#annotations
337337
:bean-validation: https://docs.hibernate.org/stable/validator/reference/en-US/html_single/#chapter-bean-constraints
338338

339339
We won't have much to say about the entity classes here, simply because
@@ -578,8 +578,8 @@ custom reactive identifier generator.
578578

579579
=== JSON Mapping
580580

581-
:orm-json-basic-mapping: https://docs.hibernate.org/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#basic-mapping-json
582-
:orm-json-embeddable-mapping: https://docs.hibernate.org/orm/6.6/userguide/html_single/Hibernate_User_Guide.html#_jsonxml_aggregate_embeddable_mapping
581+
:orm-json-basic-mapping: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#basic-mapping-json
582+
:orm-json-embeddable-mapping: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#_jsonxml_aggregate_embeddable_mapping
583583
:string-to-json-converter: https://github.com/hibernate/hibernate-reactive/blob/main/hibernate-reactive-core/src/test/java/org/hibernate/reactive/types/StringToJsonConverter.java
584584

585585
Like in Hibernate ORM, it's possible to map a JSON field using the {orm-json-basic-mapping}[SqlTypes.JSON]
@@ -1306,7 +1306,7 @@ or `delete` queries, or even native SQL that calls a stored procedure!
13061306
13071307
=== Association fetching
13081308
1309-
:association-fetching: https://docs.hibernate.org/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#fetching
1309+
:association-fetching: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#fetching
13101310
13111311
Achieving high performance in ORM means minimizing the number of round
13121312
trips to the database. This goal should be uppermost in your mind
@@ -1368,7 +1368,7 @@ You can find much more information about association fetching in the
13681368
13691369
=== Enabling the second-level cache
13701370
1371-
:second-level-cache: https://docs.hibernate.org/orm/5.4/userguide/html_single/Hibernate_User_Guide.html#caching
1371+
:second-level-cache: https://docs.hibernate.org/orm/{ormMinorVersion}/userguide/html_single/#caching
13721372
13731373
A classic way to reduce the number of accesses to the database is to
13741374
use a second-level cache, allowing cached data to be shared between

0 commit comments

Comments
 (0)