Skip to content

Upgrade to Hibernate ORM 7 #41310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
961d2d4
Remove some dead code in Panache using Hibernate ORM internals
yrodiere May 15, 2025
e391bea
Upgrade to Hibernate ORM 7.0.0.Alpha3
yrodiere Jun 4, 2024
0f4e8a4
Disallow CDI beans impacting metadata creation
yrodiere Sep 4, 2024
6f4cfac
Upgrade to Hibernate ORM 7.0.0.Beta1
yrodiere Sep 4, 2024
101b303
Make Hibernate ORM and jdbc-derby extensions work without any other r…
yrodiere Sep 16, 2024
47b47c4
Upgrade to Hibernate ORM 7.0.0.Beta3 / Reactive 3.0.0.Beta1
yrodiere Nov 18, 2024
873f397
Adapt QuarkusStrategySelectorBuilder to changes in StrategySelectorBu…
yrodiere Dec 20, 2024
4ef2010
Work around https://hibernate.atlassian.net/browse/HHH-19033
yrodiere Jan 10, 2025
819d1c5
Upgrade to Hibernate ORM 7.0.0.Beta4 / Reactive 3.0.0.Beta2
yrodiere Jan 23, 2025
ec03a95
Take into account feature removal HHH-18584 in tests
yrodiere Mar 19, 2025
30d9c9e
Upgrade to Hibernate Search 8.0.0.Alpha1
yrodiere Mar 14, 2025
08a6080
Upgrade to Hibernate Search 8.0.0.Alpha2
yrodiere Mar 19, 2025
b03a2f8
Upgrade to Hibernate ORM 7.0.0.Beta5 / Hibernate Reactive 3.0.0.Beta3
yrodiere Mar 24, 2025
f8b10ca
Upgrade to Hibernate Search 8.0.0.Alpha3
yrodiere Mar 25, 2025
5b89722
Upgrade to Hibernate ORM 7.0.0.CR1 / Hibernate Reactive 3.0.0.CR1 / H…
yrodiere Apr 25, 2025
604cc12
Upgrade to Hibernate ORM 7.0.0.CR2 / Hibernate Reactive 3.0.0.CR2
yrodiere May 15, 2025
53905aa
Upgrade to Hibernate ORM 7.0.0.Final / Hibernate Reactive 3.0.0.Final…
yrodiere May 20, 2025
9af61d7
Upgrade to Elasticsearch client 9.0.1
marko-bekhta May 31, 2025
81042d3
Bump Elasticsearch/OpenSearch containers to latest-compatible with Hi…
marko-bekhta May 31, 2025
4cce5cb
Restore proxy-related tests using `@ConcreteProxy` instead of `@Proxy…
yrodiere Jun 5, 2025
5a21af8
Expose `jakarta.persistence.SchemaManager` as a CDI bean
yrodiere Jun 5, 2025
de9ac30
Upgrade to Hibernate Models 1.0.0
yrodiere Jun 6, 2025
eaefb92
Upgrade to Hibernate Search 8.0.0.Final / Elasticsearch client 9.0.2
yrodiere Jun 6, 2025
11a6cd8
Bump the maximum number of connections for Elasticsearch
yrodiere Jun 6, 2025
4fb68cb
Remove unnecessary log disabling for Hibernate Search
yrodiere Jun 6, 2025
78b5979
Use hibernate-processor instead of the hibernate-jpamodelgen
marko-bekhta Jun 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@
<commons-codec.version>1.18.0</commons-codec.version>
<classmate.version>1.7.0</classmate.version>
<!-- See root POM for hibernate-orm.version, hibernate-reactive.version, hibernate-validator.version,
hibernate-search.version, antlr.version, bytebuddy.version, hibernate-commons-annotations.version -->
hibernate-search.version, antlr.version, bytebuddy.version -->
<narayana.version>7.2.2.Final</narayana.version>
<narayana-lra.version>1.0.0.Final</narayana-lra.version>
<agroal.version>2.7.1</agroal.version>
<jboss-transaction-spi.version>8.0.0.Final</jboss-transaction-spi.version>
<elasticsearch-opensource-components.version>8.18.2</elasticsearch-opensource-components.version>
<elasticsearch-opensource-components.version>9.0.2</elasticsearch-opensource-components.version>
<rxjava.version>2.2.21</rxjava.version>
<wildfly.openssl-java.version>2.2.5.Final</wildfly.openssl-java.version>
<wildfly.openssl-linux.version>2.2.2.SP01</wildfly.openssl-linux.version>
Expand Down Expand Up @@ -1284,6 +1284,16 @@
<artifactId>quarkus-hibernate-orm-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-envers</artifactId>
Expand Down Expand Up @@ -5474,13 +5484,6 @@
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate-orm.version}</version>
<exclusions>
<!-- We don't want Jandex at runtime -->
<exclusion>
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
Expand All @@ -5492,6 +5495,11 @@
<artifactId>hibernate-envers</artifactId>
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-processor</artifactId>
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
Expand All @@ -5506,9 +5514,9 @@
<version>${hibernate-orm.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>${hibernate-commons-annotations.version}</version>
<groupId>org.hibernate.models</groupId>
<artifactId>hibernate-models</artifactId>
<version>${hibernate-models.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
Expand Down Expand Up @@ -5545,6 +5553,10 @@
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate.models</groupId>
<artifactId>hibernate-models-jandex</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand All @@ -5569,6 +5581,10 @@
<groupId>io.smallrye</groupId>
<artifactId>jandex</artifactId>
</exclusion>
<exclusion>
<groupId>org.hibernate.models</groupId>
<artifactId>hibernate-models-jandex</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down Expand Up @@ -5678,11 +5694,11 @@
<groupId>co.elastic.clients</groupId>
<artifactId>elasticsearch-java</artifactId>
<version>${elasticsearch-opensource-components.version}</version>
<!-- exclude log4j2 to get its version from log4j2-jboss-logmanager -->
<!-- exclude commons-logging to get its version from commons-logging-jboss-logmanager -->
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
Expand Down
4 changes: 2 additions & 2 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@
<volume.access.modifier>:Z</volume.access.modifier>

<!-- Defaults for integration tests -->
<elasticsearch-server.version>8.18.2</elasticsearch-server.version>
<elasticsearch-server.version>9.0.2</elasticsearch-server.version>
<elasticsearch.image>docker.io/elastic/elasticsearch:${elasticsearch-server.version}</elasticsearch.image>
<logstash.image>docker.io/elastic/logstash:${elasticsearch-server.version}</logstash.image>
<kibana.image>docker.io/elastic/kibana:${elasticsearch-server.version}</kibana.image>
<elasticsearch.protocol>http</elasticsearch.protocol>
<opensearch-server.version>2.16.0</opensearch-server.version>
<opensearch-server.version>3.0.0</opensearch-server.version>
<opensearch.image>docker.io/opensearchproject/opensearch:${opensearch-server.version}</opensearch.image>
<opensearch.protocol>http</opensearch.protocol>
<junit-pioneer.version>2.2.0</junit-pioneer.version>
Expand Down
13 changes: 13 additions & 0 deletions devtools/bom-descriptor-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -850,6 +850,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
Expand Down
13 changes: 13 additions & 0 deletions docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,19 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
<version>${project.version}</version>
<type>pom</type>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache-deployment</artifactId>
Expand Down
17 changes: 10 additions & 7 deletions docs/src/main/asciidoc/hibernate-orm.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -515,14 +515,17 @@ HibernateCriteriaBuilder hibernateCriteriaBuilder;
Metamodel metamodel;

@Inject
Cache cache;
jakarta.persistence.Cache cache;

@Inject
org.hibernate.Cache cache;

@Inject
jakarta.persistence.PersistenceUnitUtil persistenceUnitUtil;

@Inject
jakarta.persistence.SchemaManager schemaManager;

@Inject
org.hibernate.relational.SchemaManager schemaManager;
----
Expand Down Expand Up @@ -1692,8 +1695,8 @@ section of the Hibernate Validator guide for more details.
== Static metamodel and Jakarta Data

Both static metamodel and Jakarta Data capabilities of Hibernate ORM are available in Quarkus
through the `hibernate-jpamodelgen` annotation processor. Since it is an annotation processor,
you must configure the annotation processor in your build tool:
through the `hibernate-processor` annotation processor. Since it is an annotation processor,
you must configure it accordingly in your build tool:

[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
.pom.xml
Expand All @@ -1704,7 +1707,7 @@ you must configure the annotation processor in your build tool:
<annotationProcessorPaths>
<path>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<artifactId>hibernate-processor</artifactId>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will probably need to write an OpenRewrite recipe for this one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we already have the recipes for this version? I've only seen some for the previous ones, when making the change but maybe I just missed it 🙈

<!-- Note, no artifact version is required, it's managed by Quarkus. -->
</path>
<!-- other processors that may be required by your app -->
Expand All @@ -1718,9 +1721,9 @@ you must configure the annotation processor in your build tool:
.build.gradle
----
// Enforce the version management of your annotation processor dependencies,
// so that there's no need to define an explicit version of the hibernate-jpamodelgen
// so that there's no need to define an explicit version of the hibernate-processor
annotationProcessor enforcedPlatform("${quarkusPlatformGroupId}:${quarkusPlatformArtifactId}:${quarkusPlatformVersion}")
annotationProcessor 'org.hibernate.orm:hibernate-jpamodelgen'
annotationProcessor 'org.hibernate.orm:hibernate-processor'
----

=== Static metamodel
Expand Down Expand Up @@ -1757,7 +1760,7 @@ For a more detailed overview of static metamodel, please refer to the link:{jaka

=== Jakarta Data

Jakarta Data requires, besides having the `hibernate-jpamodelgen` annotation processor in place, one extra dependency to be added:
Jakarta Data requires, besides having the `hibernate-processor` annotation processor in place, one extra dependency to be added:

[source,xml,role="primary asciidoc-tabs-target-sync-cli asciidoc-tabs-target-sync-maven"]
.pom.xml
Expand Down
10 changes: 5 additions & 5 deletions docs/src/main/asciidoc/hibernate-search-orm-elasticsearch.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ quarkus.datasource.db-kind=postgresql <1>

quarkus.hibernate-orm.sql-load-script=import.sql <2>

quarkus.hibernate-search-orm.elasticsearch.version=8 <3>
quarkus.hibernate-search-orm.elasticsearch.version=9 <3>
quarkus.hibernate-search-orm.indexing.plan.synchronization.strategy=sync <4>

%prod.quarkus.datasource.jdbc.url=jdbc:postgresql://localhost/quarkus_test
Expand Down Expand Up @@ -820,7 +820,7 @@ as shown below.

[source,properties]
----
quarkus.hibernate-search-orm.elasticsearch.version=opensearch:2.16
quarkus.hibernate-search-orm.elasticsearch.version=opensearch:3.0
----

All other configuration options and APIs are exactly the same as with Elasticsearch.
Expand Down Expand Up @@ -850,7 +850,7 @@ quarkus.datasource.db-kind=h2
quarkus.datasource.jdbc.url=jdbc:h2:mem:default;DB_CLOSE_DELAY=-1

quarkus.hibernate-search-orm.elasticsearch.hosts=es1.mycompany.com:9200
quarkus.hibernate-search-orm.elasticsearch.version=8
quarkus.hibernate-search-orm.elasticsearch.version=9
----

Using a map based approach, it is also possible to configure named persistence units:
Expand All @@ -870,10 +870,10 @@ quarkus.hibernate-orm."inventory".datasource=inventory <4>
quarkus.hibernate-orm."inventory".packages=org.acme.model.inventory

quarkus.hibernate-search-orm."users".elasticsearch.hosts=es1.mycompany.com:9200 <5>
quarkus.hibernate-search-orm."users".elasticsearch.version=8
quarkus.hibernate-search-orm."users".elasticsearch.version=9

quarkus.hibernate-search-orm."inventory".elasticsearch.hosts=es2.mycompany.com:9200 <6>
quarkus.hibernate-search-orm."inventory".elasticsearch.version=8
quarkus.hibernate-search-orm."inventory".elasticsearch.version=9
----
<1> Define a datasource named `users`.
<2> Define a datasource named `inventory`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ Edit `src/main/resources/application.properties` and inject the following config
[source,properties]
----
quarkus.hibernate-search-standalone.mapping.structure=document <1>
quarkus.hibernate-search-standalone.elasticsearch.version=8 <2>
quarkus.hibernate-search-standalone.elasticsearch.version=9 <2>
quarkus.hibernate-search-standalone.indexing.plan.synchronization.strategy=sync <3>

%prod.quarkus.hibernate-search-standalone.elasticsearch.hosts=localhost:9200 <4>
Expand Down Expand Up @@ -738,7 +738,7 @@ as shown below.

[source,properties]
----
quarkus.hibernate-search-standalone.elasticsearch.version=opensearch:2.16
quarkus.hibernate-search-standalone.elasticsearch.version=opensearch:3.0
----

All other configuration options and APIs are exactly the same as with Elasticsearch.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ public interface ElasticsearchConfig {
/**
* The maximum number of connections to all the Elasticsearch servers.
*/
@WithDefault("20")
@WithDefault("40")
int maxConnections();

/**
* The maximum number of connections per Elasticsearch server.
*/
@WithDefault("10")
@WithDefault("20")
int maxConnectionsPerRoute();

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@ public final class HibernateEnversProcessor {
List<AdditionalJpaModelBuildItem> addJpaModelClasses() {
return Arrays.asList(
new AdditionalJpaModelBuildItem("org.hibernate.envers.DefaultRevisionEntity"),
new AdditionalJpaModelBuildItem("org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity"));
new AdditionalJpaModelBuildItem("org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity"),
new AdditionalJpaModelBuildItem("org.hibernate.envers.RevisionMapping"),
new AdditionalJpaModelBuildItem("org.hibernate.envers.TrackingModifiedEntitiesRevisionMapping"));
}

@BuildStep
public void registerEnversReflections(BuildProducer<ReflectiveClassBuildItem> reflectiveClass,
HibernateEnversBuildTimeConfig buildTimeConfig) {
// This is necessary because these classes are added to the model conditionally at static init,
// so they don't get processed by HibernateOrmProcessor and in particular don't get reflection enabled.
reflectiveClass.produce(ReflectiveClassBuildItem.builder(
"org.hibernate.envers.DefaultRevisionEntity",
"org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity")
"org.hibernate.envers.DefaultTrackingModifiedEntitiesRevisionEntity",
"org.hibernate.envers.RevisionMapping",
"org.hibernate.envers.TrackingModifiedEntitiesRevisionMapping")
.reason(getClass().getName())
.methods().build());

Expand Down
60 changes: 60 additions & 0 deletions extensions/hibernate-orm-derby/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>quarkus-hibernate-orm-derby-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
<name>Quarkus - Hibernate ORM - Derby - Deployment</name>
<description>This extensions is added by Quarkus automatically when quarkus-hibernate-orm and quarkus-jdbc-derby are on the classpath</description>

<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-core-deployment</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-deployment-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-datasource-common</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>default-compile</id>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-processor</artifactId>
<version>${project.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>


</project>
Loading
Loading