Skip to content

Hibernate ORM tries to connect to the database on startup even with schema validation disabled #48130

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

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
8248739
Remove some dead code in Panache using Hibernate ORM internals
yrodiere May 15, 2025
6744eac
Upgrade to Hibernate ORM 7.0.0.Alpha3
yrodiere Jun 4, 2024
b51ab1b
Disallow CDI beans impacting metadata creation
yrodiere Sep 4, 2024
4d583f2
Upgrade to Hibernate ORM 7.0.0.Beta1
yrodiere Sep 4, 2024
1703507
Make Hibernate ORM and jdbc-derby extensions work without any other r…
yrodiere Sep 16, 2024
340d64b
Upgrade to Hibernate ORM 7.0.0.Beta3 / Reactive 3.0.0.Beta1
yrodiere Nov 18, 2024
a0505c6
Adapt QuarkusStrategySelectorBuilder to changes in StrategySelectorBu…
yrodiere Dec 20, 2024
40ac7d9
Work around https://hibernate.atlassian.net/browse/HHH-19033
yrodiere Jan 10, 2025
2cd3179
Upgrade to Hibernate ORM 7.0.0.Beta4 / Reactive 3.0.0.Beta2
yrodiere Jan 23, 2025
71bd8e6
Take into account feature removal HHH-18584 in tests
yrodiere Mar 19, 2025
ed7d5da
Upgrade to Hibernate Search 8.0.0.Alpha1
yrodiere Mar 14, 2025
05b07e1
Upgrade to Hibernate Search 8.0.0.Alpha2
yrodiere Mar 19, 2025
e1af27b
Upgrade to Hibernate ORM 7.0.0.Beta5 / Hibernate Reactive 3.0.0.Beta3
yrodiere Mar 24, 2025
2fb2e72
Upgrade to Hibernate Search 8.0.0.Alpha3
yrodiere Mar 25, 2025
815681d
Upgrade to Hibernate ORM 7.0.0.CR1 / Hibernate Reactive 3.0.0.CR1 / H…
yrodiere Apr 25, 2025
9a0bb7f
Upgrade to Hibernate ORM 7.0.0.CR2 / Hibernate Reactive 3.0.0.CR2
yrodiere May 15, 2025
30a081d
Upgrade to Hibernate ORM 7.0.0.Final / Hibernate Reactive 3.0.0.Final
yrodiere May 20, 2025
6f91e02
Make it possible to start without connecting to the database
lucamolteni May 27, 2025
1970dc3
StartOfflineTest
lucamolteni May 28, 2025
60a7f70
Same check in Hibernate Reactive
lucamolteni May 29, 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
33 changes: 22 additions & 11 deletions bom/application/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<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</agroal.version>
Expand Down Expand Up @@ -1265,6 +1265,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 @@ -5490,13 +5500,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 @@ -5522,9 +5525,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 @@ -5561,6 +5564,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 @@ -5585,6 +5592,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
13 changes: 13 additions & 0 deletions devtools/bom-descriptor-json/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,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 @@ -846,6 +846,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
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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import java.util.Set;

import org.hibernate.community.dialect.CommunityDialectResolver;
import org.hibernate.engine.jdbc.dialect.spi.DialectResolver;

import io.quarkus.datasource.common.runtime.DatabaseKind;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.builditem.nativeimage.ServiceProviderBuildItem;
import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem;

public final class HibernateOrmDerbyProcessor {
@BuildStep
public DatabaseKindDialectBuildItem registerHibernateOrmMetadataForDerbyDialect() {
return DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DERBY, "Apache Derby",
Set.of("org.hibernate.community.dialect.DerbyDialect"));
}

@BuildStep
public ServiceProviderBuildItem registerCommunityDialectResolver() {
return new ServiceProviderBuildItem(DialectResolver.class.getName(), CommunityDialectResolver.class.getName());
}
}
21 changes: 21 additions & 0 deletions extensions/hibernate-orm-derby/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?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-extensions-parent</artifactId>
<groupId>io.quarkus</groupId>
<version>999-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>quarkus-hibernate-orm-derby-parent</artifactId>
<name>Quarkus - Hibernate ORM - Derby - Deployment</name>
<packaging>pom</packaging>
<modules>
<module>runtime</module>
<module>deployment</module>
</modules>
</project>
68 changes: 68 additions & 0 deletions extensions/hibernate-orm-derby/runtime/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?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</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</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-community-dialects</artifactId>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-maven-plugin</artifactId>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>extension-descriptor</goal>
</goals>
<configuration>
<deployment>${project.groupId}:${project.artifactId}-deployment:${project.version}</deployment>
<dependencyCondition>
<artifact>io.quarkus:quarkus-jdbc-derby</artifact>
</dependencyCondition>
</configuration>
</execution>
</executions>
</plugin>
<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>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name: Quarkus Hibernate ORM Derby
artifact: ${project.groupId}:${project.artifactId}:${project.version}
description: Conditional extension added when Hibernate ORM and the Derby JDBC driver are present
metadata:
unlisted: true

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public final class DatabaseKindDialectBuildItem extends MultiBuildItem {
* @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind}
* @param databaseProductName The corresponding database-product-name to set in Hibernate ORM.
* See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect.
* Also works with {@code org.hibernate.community.dialect.CommunityDatabase} if
* {@code hibernate-community-dialects} is in the classpath.
* @param dialects The corresponding dialects in Hibernate ORM,
* to detect the dbKind when using database multi-tenancy.
*/
Expand All @@ -32,6 +34,8 @@ public static DatabaseKindDialectBuildItem forCoreDialect(String dbKind, String
* @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind}
* @param databaseProductName The corresponding database-product-name to set in Hibernate ORM.
* See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect.
* Also works with {@code org.hibernate.community.dialect.CommunityDatabase} if
* {@code hibernate-community-dialects} is in the classpath.
* @param dialects The corresponding dialects in Hibernate ORM,
* to detect the dbKind when using database multi-tenancy.
* @param defaultDatabaseProductVersion The default database-product-version to set in Hibernate ORM.
Expand Down
6 changes: 6 additions & 0 deletions extensions/hibernate-orm/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-vertx-http-dev-ui-spi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-derby-deployment</artifactId>
<optional>true</optional> <!-- conditional dependency -->
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
Expand Down
Loading