From 8f1723499b5dc790414574ff01cc5f953b6a4a2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 21:39:30 +0000 Subject: [PATCH 1/5] Bump hibernate-orm.version from 6.5.0.Final to 6.5.1.Final Bumps `hibernate-orm.version` from 6.5.0.Final to 6.5.1.Final. Updates `org.hibernate.orm:hibernate-core` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) Updates `org.hibernate.orm:hibernate-graalvm` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) Updates `org.hibernate.orm:hibernate-envers` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) Updates `org.hibernate.orm:hibernate-jpamodelgen` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) Updates `org.hibernate:hibernate-jpamodelgen` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) Updates `org.hibernate.orm:hibernate-community-dialects` from 6.5.0.Final to 6.5.1.Final - [Release notes](https://github.com/hibernate/hibernate-orm/releases) - [Changelog](https://github.com/hibernate/hibernate-orm/blob/6.5.1/changelog.txt) - [Commits](https://github.com/hibernate/hibernate-orm/compare/6.5.0...6.5.1) --- updated-dependencies: - dependency-name: org.hibernate.orm:hibernate-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.hibernate.orm:hibernate-graalvm dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.hibernate.orm:hibernate-envers dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.hibernate.orm:hibernate-jpamodelgen dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.hibernate:hibernate-jpamodelgen dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.hibernate.orm:hibernate-community-dialects dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- bom/application/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 87a682ec29e3a..2c747cacd1313 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -101,7 +101,7 @@ bytebuddy.version (just below), hibernate-orm.version-for-documentation (in docs/pom.xml) and both hibernate-orm.version and antlr.version in build-parent/pom.xml WARNING again for diffs that don't provide enough context: when updating, see above --> - 6.5.0.Final + 6.5.1.Final 1.14.12 6.0.6.Final 2.3.0.Final From 3a1f9988c3156f676697ae378b35f2415a41278e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 14 May 2024 06:56:38 +0200 Subject: [PATCH 2/5] Upgrade to bytebuddy 1.14.15 to align with Hibernate ORM --- bom/application/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 2c747cacd1313..24d281c665af2 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -102,7 +102,7 @@ and both hibernate-orm.version and antlr.version in build-parent/pom.xml WARNING again for diffs that don't provide enough context: when updating, see above --> 6.5.1.Final - 1.14.12 + 1.14.15 6.0.6.Final 2.3.0.Final 8.0.1.Final From f3e463beebf49b24efe13f16c95c525247e3612b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Fri, 3 May 2024 17:46:00 +0200 Subject: [PATCH 3/5] Configure Hibernate ORM/Reactive with database product names instead of dialect names for core dialects Mainly to avoid Hibernate ORM logging warnings on startup. --- .../spi/DatabaseKindDialectBuildItem.java | 87 ++++++++++++++++++- .../orm/deployment/HibernateOrmProcessor.java | 62 ++++++++----- .../reactive/deployment/Dialects.java | 34 -------- .../HibernateReactiveProcessor.java | 42 +++++---- 4 files changed, 147 insertions(+), 78 deletions(-) delete mode 100644 extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/Dialects.java diff --git a/extensions/hibernate-orm/deployment-spi/src/main/java/io/quarkus/hibernate/orm/deployment/spi/DatabaseKindDialectBuildItem.java b/extensions/hibernate-orm/deployment-spi/src/main/java/io/quarkus/hibernate/orm/deployment/spi/DatabaseKindDialectBuildItem.java index fe807866175cf..0087e4334b4f7 100644 --- a/extensions/hibernate-orm/deployment-spi/src/main/java/io/quarkus/hibernate/orm/deployment/spi/DatabaseKindDialectBuildItem.java +++ b/extensions/hibernate-orm/deployment-spi/src/main/java/io/quarkus/hibernate/orm/deployment/spi/DatabaseKindDialectBuildItem.java @@ -1,6 +1,7 @@ package io.quarkus.hibernate.orm.deployment.spi; import java.util.Optional; +import java.util.Set; import io.quarkus.builder.item.MultiBuildItem; @@ -9,15 +10,74 @@ */ public final class DatabaseKindDialectBuildItem extends MultiBuildItem { private final String dbKind; - private final String dialect; + private final Optional databaseProductName; + private final Optional dialect; + private final Set matchingDialects; private final Optional defaultDatabaseProductVersion; + /** + * @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. + * @param dialects The corresponding dialects in Hibernate ORM, + * to detect the dbKind when using database multi-tenancy. + */ + public static DatabaseKindDialectBuildItem forCoreDialect(String dbKind, String databaseProductName, + Set dialects) { + return new DatabaseKindDialectBuildItem(dbKind, Optional.empty(), Optional.of(databaseProductName), + dialects, Optional.empty()); + } + + /** + * @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. + * @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. + * This is useful when the default version of the dialect in Hibernate ORM + * is lower than what we expect in Quarkus. + */ + public static DatabaseKindDialectBuildItem forCoreDialect(String dbKind, String databaseProductName, + Set dialects, String defaultDatabaseProductVersion) { + return new DatabaseKindDialectBuildItem(dbKind, Optional.empty(), Optional.of(databaseProductName), + dialects, Optional.of(defaultDatabaseProductVersion)); + } + + /** + * @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind} + * @param dialect The corresponding dialect to set in Hibernate ORM. + * See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect. + */ + public static DatabaseKindDialectBuildItem forThirdPartyDialect(String dbKind, String dialect) { + return new DatabaseKindDialectBuildItem(dbKind, Optional.of(dialect), Optional.empty(), Set.of(dialect), + Optional.empty()); + } + /** * @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind} * @param dialect The corresponding dialect to set in Hibernate ORM. + * See {@code org.hibernate.dialect.Database} for information on how this name is resolved to a dialect. + * @param defaultDatabaseProductVersion The default database-product-version to set in Hibernate ORM. + * This is useful when the default version of the dialect in Hibernate ORM + * is lower than what we expect in Quarkus. */ + public static DatabaseKindDialectBuildItem forThirdPartyDialect(String dbKind, String dialect, + String defaultDatabaseProductVersion) { + return new DatabaseKindDialectBuildItem(dbKind, Optional.of(dialect), Optional.empty(), + Set.of(dialect), Optional.of(defaultDatabaseProductVersion)); + } + + /** + * @param dbKind The DB Kind set through {@code quarkus.datasource.db-kind} + * @param dialect The corresponding dialect to set in Hibernate ORM. + * @deprecated Use {@link #forCoreDialect(String, String, Set)}(different arguments!) + * for core Hibernate ORM dialects to avoid warnings on startup, + * or {@link #forThirdPartyDialect(String, String)} for community or third-party dialects. + */ + @Deprecated public DatabaseKindDialectBuildItem(String dbKind, String dialect) { - this(dbKind, dialect, Optional.empty()); + this(dbKind, Optional.of(dialect), Optional.empty(), Set.of(dialect), Optional.empty()); } /** @@ -27,15 +87,22 @@ public DatabaseKindDialectBuildItem(String dbKind, String dialect) { * @param defaultDatabaseProductVersion The default database-product-version to set in Hibernate ORM. * This is useful when the default version of the dialect in Hibernate ORM * is lower than what we expect in Quarkus. + * @deprecated Use {@link #forCoreDialect(String, String, Set, String)}(different arguments!) + * for core Hibernate ORM dialects to avoid warnings on startup, + * or {@link #forThirdPartyDialect(String, String, String)} for community or third-party dialects. */ + @Deprecated public DatabaseKindDialectBuildItem(String dbKind, String dialect, String defaultDatabaseProductVersion) { - this(dbKind, dialect, Optional.of(defaultDatabaseProductVersion)); + this(dbKind, Optional.of(dialect), Optional.empty(), Set.of(dialect), Optional.of(defaultDatabaseProductVersion)); } - private DatabaseKindDialectBuildItem(String dbKind, String dialect, + private DatabaseKindDialectBuildItem(String dbKind, Optional dialect, + Optional databaseProductName, Set matchingDialects, Optional defaultDatabaseProductVersion) { this.dbKind = dbKind; this.dialect = dialect; + this.matchingDialects = matchingDialects; + this.databaseProductName = databaseProductName; this.defaultDatabaseProductVersion = defaultDatabaseProductVersion; } @@ -44,9 +111,21 @@ public String getDbKind() { } public String getDialect() { + return dialect.get(); + } + + public Optional getDialectOptional() { return dialect; } + public Set getMatchingDialects() { + return matchingDialects; + } + + public Optional getDatabaseProductName() { + return databaseProductName; + } + public Optional getDefaultDatabaseProductVersion() { return defaultDatabaseProductVersion; } diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java index 54b5f4de5f5aa..f8533053f2012 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmProcessor.java @@ -162,24 +162,27 @@ public final class HibernateOrmProcessor { @BuildStep void registerHibernateOrmMetadataForCoreDialects( BuildProducer producer) { - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.DB2, - "org.hibernate.dialect.DB2Dialect")); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.DERBY, - "org.hibernate.dialect.DerbyDialect")); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.H2, + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DB2, "DB2", + Set.of("org.hibernate.dialect.DB2Dialect"))); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.DERBY, "Apache Derby", + Set.of("org.hibernate.dialect.DerbyDialect"))); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.H2, "H2", + Set.of("org.hibernate.dialect.H2Dialect"), // Using our own default version is extra important for H2 // See https://github.com/quarkusio/quarkus/issues/1886 - "org.hibernate.dialect.H2Dialect", DialectVersions.Defaults.H2)); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.MARIADB, - "org.hibernate.dialect.MariaDBDialect", DialectVersions.Defaults.MARIADB)); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.MSSQL, - "org.hibernate.dialect.SQLServerDialect", DialectVersions.Defaults.MSSQL)); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.MYSQL, - "org.hibernate.dialect.MySQLDialect")); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.ORACLE, - "org.hibernate.dialect.OracleDialect")); - producer.produce(new DatabaseKindDialectBuildItem(DatabaseKind.POSTGRESQL, - "org.hibernate.dialect.PostgreSQLDialect")); + DialectVersions.Defaults.H2)); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.MARIADB, "MariaDB", + Set.of("org.hibernate.dialect.MariaDBDialect"), + DialectVersions.Defaults.MARIADB)); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.MSSQL, "Microsoft SQL Server", + Set.of("org.hibernate.dialect.SQLServerDialect"), + DialectVersions.Defaults.MSSQL)); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.MYSQL, "MySQL", + Set.of("org.hibernate.dialect.MySQLDialect"))); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.ORACLE, "Oracle", + Set.of("org.hibernate.dialect.OracleDialect"))); + producer.produce(DatabaseKindDialectBuildItem.forCoreDialect(DatabaseKind.POSTGRESQL, "PostgreSQL", + Set.of("org.hibernate.dialect.PostgreSQLDialect"))); } @BuildStep @@ -1107,15 +1110,18 @@ private static void collectDialectConfig(String persistenceUnitName, } Optional dialect = explicitDialect; + Optional dbProductName = Optional.empty(); Optional dbProductVersion = explicitDbMinVersion; if (dbKind.isPresent() || explicitDialect.isPresent()) { for (DatabaseKindDialectBuildItem item : dbKindMetadataBuildItems) { if (dbKind.isPresent() && DatabaseKind.is(dbKind.get(), item.getDbKind()) // Set the default version based on the dialect when we don't have a datasource // (i.e. for database multi-tenancy) - || explicitDialect.isPresent() && explicitDialect.get().equals(item.getDialect())) { - if (explicitDialect.isEmpty()) { - dialect = Optional.of(item.getDialect()); + || explicitDialect.isPresent() && item.getMatchingDialects().contains(explicitDialect.get())) { + dbProductName = item.getDatabaseProductName(); + if (dbProductName.isEmpty() && explicitDialect.isEmpty()) { + // Use dialects only as a last resort, prefer product name or explicitly user-provided dialect + dialect = item.getDialectOptional(); } if (explicitDbMinVersion.isEmpty()) { dbProductVersion = item.getDefaultDatabaseProductVersion(); @@ -1123,7 +1129,7 @@ private static void collectDialectConfig(String persistenceUnitName, break; } } - if (dialect.isEmpty()) { + if (dialect.isEmpty() && dbProductName.isEmpty()) { throw new ConfigurationException( "The Hibernate ORM extension could not guess the dialect from the database kind '" + dbKind.get() + "'. Add an explicit '" @@ -1134,6 +1140,8 @@ private static void collectDialectConfig(String persistenceUnitName, if (dialect.isPresent()) { puPropertiesCollector.accept(AvailableSettings.DIALECT, dialect.get()); + } else if (dbProductName.isPresent()) { + puPropertiesCollector.accept(AvailableSettings.JAKARTA_HBM2DDL_DB_NAME, dbProductName.get()); } else { // We only get here with the database multi-tenancy strategy; see the initial check, up top. assert multiTenancyStrategy == MultiTenancyStrategy.DATABASE; @@ -1148,7 +1156,7 @@ private static void collectDialectConfig(String persistenceUnitName, if (persistenceUnitConfig.dialect().storageEngine().isPresent()) { // Only actually set the storage engines if MySQL or MariaDB - if (isMySQLOrMariaDB(dialect.get())) { + if (isMySQLOrMariaDB(dbKind, dialect)) { // The storage engine has to be set as a system property. // We record it so that we can later run checks (because we can only set a single value) storageEngineCollector.add(persistenceUnitConfig.dialect().storageEngine().get()); @@ -1609,9 +1617,15 @@ private static Class[] toArray(final Set> interfaces) { return interfaces.toArray(new Class[interfaces.size()]); } - private static boolean isMySQLOrMariaDB(String dialect) { - String lowercaseDialect = dialect.toLowerCase(Locale.ROOT); - return lowercaseDialect.contains("mysql") || lowercaseDialect.contains("mariadb"); + private static boolean isMySQLOrMariaDB(Optional dbKind, Optional dialect) { + if (dbKind.isPresent() && (DatabaseKind.isMySQL(dbKind.get()) || DatabaseKind.isMariaDB(dbKind.get()))) { + return true; + } + if (dialect.isPresent()) { + String lowercaseDialect = dialect.get().toLowerCase(Locale.ROOT); + return lowercaseDialect.contains("mysql") || lowercaseDialect.contains("mariadb"); + } + return false; } private static final class ProxyCache { diff --git a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/Dialects.java b/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/Dialects.java deleted file mode 100644 index a699c1fabea6d..0000000000000 --- a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/Dialects.java +++ /dev/null @@ -1,34 +0,0 @@ -package io.quarkus.hibernate.reactive.deployment; - -import java.util.List; - -import io.quarkus.datasource.common.runtime.DatabaseKind; -import io.quarkus.hibernate.orm.deployment.spi.DatabaseKindDialectBuildItem; -import io.quarkus.hibernate.orm.runtime.HibernateOrmRuntimeConfig; -import io.quarkus.runtime.configuration.ConfigurationException; - -/** - * This used to be the approach before 6bf38240 in the Hibernate ORM extension as well. - * Align to ORM? TBD - */ -@Deprecated -final class Dialects { - - private Dialects() { - //utility - } - - public static String guessDialect(String persistenceUnitName, String resolvedDbKind, - List dbKindDialectBuildItems) { - for (DatabaseKindDialectBuildItem item : dbKindDialectBuildItems) { - if (DatabaseKind.is(resolvedDbKind, item.getDbKind())) { - return item.getDialect(); - } - } - - String error = "The Hibernate ORM extension could not guess the dialect from the database kind '" + resolvedDbKind - + "'. Add an explicit '" + HibernateOrmRuntimeConfig.puPropertyKey(persistenceUnitName, "dialect") - + "' property."; - throw new ConfigurationException(error); - } -} diff --git a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java b/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java index 37303a0f579a1..cd55a007cab70 100644 --- a/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java +++ b/extensions/hibernate-reactive/deployment/src/main/java/io/quarkus/hibernate/reactive/deployment/HibernateReactiveProcessor.java @@ -427,21 +427,24 @@ private static ParsedPersistenceXmlDescriptor generateReactivePersistenceUnit( return desc; } - private static void setDialectAndStorageEngine(Optional dbKindOptional, Optional explicitDialect, + private static void setDialectAndStorageEngine(Optional dbKind, Optional explicitDialect, Optional explicitDbMinVersion, List dbKindDialectBuildItems, Optional storageEngine, BuildProducer systemProperties, ParsedPersistenceXmlDescriptor desc) { final String persistenceUnitName = DEFAULT_PERSISTENCE_UNIT_NAME; Optional dialect = explicitDialect; + Optional dbProductName = Optional.empty(); Optional dbProductVersion = explicitDbMinVersion; - if (dbKindOptional.isPresent() || explicitDialect.isPresent()) { + if (dbKind.isPresent() || explicitDialect.isPresent()) { for (DatabaseKindDialectBuildItem item : dbKindDialectBuildItems) { - if (dbKindOptional.isPresent() && DatabaseKind.is(dbKindOptional.get(), item.getDbKind()) + if (dbKind.isPresent() && DatabaseKind.is(dbKind.get(), item.getDbKind()) // Set the default version based on the dialect when we don't have a datasource // (i.e. for database multi-tenancy) - || explicitDialect.isPresent() && explicitDialect.get().equals(item.getDialect())) { - if (explicitDialect.isEmpty()) { - dialect = Optional.of(item.getDialect()); + || explicitDialect.isPresent() && item.getMatchingDialects().contains(explicitDialect.get())) { + dbProductName = item.getDatabaseProductName(); + if (dbProductName.isEmpty() && explicitDialect.isEmpty()) { + // Use dialects only as a last resort, prefer product name or explicitly user-provided dialect + dialect = item.getDialectOptional(); } if (explicitDbMinVersion.isEmpty()) { dbProductVersion = item.getDefaultDatabaseProductVersion(); @@ -449,10 +452,10 @@ private static void setDialectAndStorageEngine(Optional dbKindOptional, break; } } - if (dialect.isEmpty()) { + if (dialect.isEmpty() && dbProductName.isEmpty()) { throw new ConfigurationException( "The Hibernate Reactive extension could not guess the dialect from the database kind '" - + dbKindOptional.get() + + dbKind.get() + "'. Add an explicit '" + HibernateOrmRuntimeConfig.puPropertyKey(persistenceUnitName, "dialect") + "' property."); @@ -461,6 +464,8 @@ private static void setDialectAndStorageEngine(Optional dbKindOptional, if (dialect.isPresent()) { desc.getProperties().setProperty(AvailableSettings.DIALECT, dialect.get()); + } else if (dbProductName.isPresent()) { + desc.getProperties().setProperty(AvailableSettings.JAKARTA_HBM2DDL_DB_NAME, dbProductName.get()); } else { // We only get here with the database multi-tenancy strategy; see the initial check, up top. throw new ConfigurationException(String.format(Locale.ROOT, @@ -472,15 +477,11 @@ private static void setDialectAndStorageEngine(Optional dbKindOptional, persistenceUnitName)); } - if (dbProductVersion.isPresent()) { - desc.getProperties().setProperty(JAKARTA_HBM2DDL_DB_VERSION, dbProductVersion.get()); - } - // The storage engine has to be set as a system property. if (storageEngine.isPresent()) { systemProperties.produce(new SystemPropertyBuildItem(STORAGE_ENGINE, storageEngine.get())); // Only actually set the storage engines if MySQL or MariaDB - if (isMySQLOrMariaDB(dialect.get())) { + if (isMySQLOrMariaDB(dbKind, dialect)) { systemProperties.produce(new SystemPropertyBuildItem(STORAGE_ENGINE, storageEngine.get())); } else { LOG.warnf("The storage engine set through configuration property '%1$s' is being ignored" @@ -489,11 +490,20 @@ private static void setDialectAndStorageEngine(Optional dbKindOptional, } } + if (dbProductVersion.isPresent()) { + desc.getProperties().setProperty(JAKARTA_HBM2DDL_DB_VERSION, dbProductVersion.get()); + } } - private static boolean isMySQLOrMariaDB(String dialect) { - String lowercaseDialect = dialect.toLowerCase(Locale.ROOT); - return lowercaseDialect.contains("mysql") || lowercaseDialect.contains("mariadb"); + private static boolean isMySQLOrMariaDB(Optional dbKind, Optional dialect) { + if (dbKind.isPresent() && (DatabaseKind.isMySQL(dbKind.get()) || DatabaseKind.isMariaDB(dbKind.get()))) { + return true; + } + if (dialect.isPresent()) { + String lowercaseDialect = dialect.get().toLowerCase(Locale.ROOT); + return lowercaseDialect.contains("mysql") || lowercaseDialect.contains("mariadb"); + } + return false; } private static void setMaxFetchDepth(ParsedPersistenceXmlDescriptor descriptor, OptionalInt maxFetchDepth) { From be45a53399360846d134f28493e8fc4f8525fb64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 14 May 2024 13:21:23 +0200 Subject: [PATCH 4/5] Remove a now unnecessary log filter for HHH-16546 --- .../hibernate/orm/deployment/HibernateLogFilterBuildStep.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java index 25d5e14f47844..2dffe9d53f761 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateLogFilterBuildStep.java @@ -30,8 +30,6 @@ void setupLogFilters(BuildProducer filters) { // Silence incubating settings warnings as we will use some for compatibility filters.produce(new LogCleanupFilterBuildItem("org.hibernate.orm.incubating", "HHH90006001")); - // https://hibernate.atlassian.net/browse/HHH-16546 - filters.produce(new LogCleanupFilterBuildItem("org.hibernate.tuple.entity.EntityMetamodel", "HHH000157")); //This "deprecation" warning isn't practical for the specific Quarkus needs, as it reminds users they don't need //to set the 'hibernate.dialect' property, however it's being set by Quarkus buildsteps so they can't avoid it. From 3782329c4d74057d1d161c2d690f3f853bc3c0e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 16 May 2024 09:15:23 +0200 Subject: [PATCH 5/5] Upgrade to Hibernate ORM 6.5.2 https://hibernate.atlassian.net/issues/?jql=project%20%3D%20HHH%20AND%20fixVersion%20in%20(6.5.2)%20ORDER%20BY%20updated --- bom/application/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 24d281c665af2..417b7b1033696 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -101,7 +101,7 @@ bytebuddy.version (just below), hibernate-orm.version-for-documentation (in docs/pom.xml) and both hibernate-orm.version and antlr.version in build-parent/pom.xml WARNING again for diffs that don't provide enough context: when updating, see above --> - 6.5.1.Final + 6.5.2.Final 1.14.15 6.0.6.Final 2.3.0.Final