diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 363390c428cb9..f3d8118d09565 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -101,10 +101,10 @@ 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.4.7.Final - 1.14.11 + 6.5.0.Final + 1.14.12 6.0.6.Final - 2.2.2.Final + 2.3.0.Final 8.0.1.Final 7.1.1.Final diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmTypes.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmTypes.java index e9f713c98007a..b60058816d1ec 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmTypes.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/HibernateOrmTypes.java @@ -231,6 +231,7 @@ private HibernateOrmTypes() { DotName.createSimple("org.hibernate.annotations.Filters"), DotName.createSimple("org.hibernate.annotations.ForeignKey"), DotName.createSimple("org.hibernate.annotations.Formula"), + DotName.createSimple("org.hibernate.annotations.FractionalSeconds"), DotName.createSimple("org.hibernate.annotations.Generated"), DotName.createSimple("org.hibernate.annotations.GeneratedColumn"), DotName.createSimple("org.hibernate.annotations.GeneratorType"), @@ -287,6 +288,7 @@ private HibernateOrmTypes() { DotName.createSimple("org.hibernate.annotations.Persister"), DotName.createSimple("org.hibernate.annotations.Polymorphism"), DotName.createSimple("org.hibernate.annotations.Proxy"), + DotName.createSimple("org.hibernate.annotations.QueryCacheLayout"), DotName.createSimple("org.hibernate.annotations.RowId"), DotName.createSimple("org.hibernate.annotations.SQLDelete"), DotName.createSimple("org.hibernate.annotations.SQLDeleteAll"), diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java index 18fd28d86a15d..4becc05929aa9 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/FastBootHibernatePersistenceProvider.java @@ -223,7 +223,7 @@ private RuntimeSettings buildRuntimeSettings(String persistenceUnitName, Recorde } // Allow detection of driver/database capabilities on runtime init (was disabled during static init) - runtimeSettingsBuilder.put("hibernate.temp.use_jdbc_metadata_defaults", "true"); + runtimeSettingsBuilder.put("hibernate.boot.allow_jdbc_metadata_access", "true"); if (!persistenceUnitConfig.unsupportedProperties().isEmpty()) { log.warnf("Persistence-unit [%s] sets unsupported properties." diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/StatelessSessionLazyDelegator.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/StatelessSessionLazyDelegator.java index fa815d3fe5d43..7315f7449a403 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/StatelessSessionLazyDelegator.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/StatelessSessionLazyDelegator.java @@ -8,6 +8,7 @@ import jakarta.persistence.criteria.CriteriaQuery; import jakarta.persistence.criteria.CriteriaUpdate; +import org.hibernate.Filter; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.SessionFactory; @@ -23,6 +24,7 @@ import org.hibernate.query.Query; import org.hibernate.query.SelectionQuery; import org.hibernate.query.criteria.HibernateCriteriaBuilder; +import org.hibernate.query.criteria.JpaCriteriaInsert; import org.hibernate.query.criteria.JpaCriteriaInsertSelect; /** @@ -91,6 +93,26 @@ public T get(Class entityClass, Object id, LockMode lockMode) { return delegate.get().get(entityClass, id, lockMode); } + @Override + public Filter enableFilter(String filterName) { + return delegate.get().enableFilter(filterName); + } + + @Override + public Filter getEnabledFilter(String filterName) { + return delegate.get().getEnabledFilter(filterName); + } + + @Override + public void disableFilter(String filterName) { + delegate.get().disableFilter(filterName); + } + + @Override + public MutationQuery createMutationQuery(JpaCriteriaInsert insertSelect) { + return delegate.get().createMutationQuery(insertSelect); + } + @Override public void refresh(Object entity) { delegate.get().refresh(entity); diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java index 33f24af8d789b..9fafd88d5a20c 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootMetadataBuilder.java @@ -274,7 +274,7 @@ private MergedSettings mergeSettings(QuarkusPersistenceUnitDefinition puDefiniti // Quarkus specific - cfg.put("hibernate.temp.use_jdbc_metadata_defaults", "false"); + cfg.put("hibernate.boot.allow_jdbc_metadata_access", "false"); //This shouldn't be encouraged, but sometimes it's really useful - and it used to be the default //in Hibernate ORM before the JPA spec would require to change this. diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java index 9541b03d0bb8c..5d616754d4a22 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedSession.java @@ -48,6 +48,7 @@ import org.hibernate.query.Query; import org.hibernate.query.SelectionQuery; import org.hibernate.query.criteria.HibernateCriteriaBuilder; +import org.hibernate.query.criteria.JpaCriteriaInsert; import org.hibernate.query.criteria.JpaCriteriaInsertSelect; import org.hibernate.stat.SessionStatistics; @@ -1317,6 +1318,14 @@ public MutationQuery createMutationQuery(JpaCriteriaInsertSelect insertSelect) { } } + @Override + public MutationQuery createMutationQuery(JpaCriteriaInsert insertSelect) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.session.createMutationQuery(insertSelect); + } + } + @Override public MutationQuery createNativeMutationQuery(String sqlString) { checkBlocking(); diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedStatelessSession.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedStatelessSession.java index c20c509377e64..5d52415fdb78a 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedStatelessSession.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/session/TransactionScopedStatelessSession.java @@ -13,6 +13,7 @@ import jakarta.transaction.TransactionManager; import jakarta.transaction.TransactionSynchronizationRegistry; +import org.hibernate.Filter; import org.hibernate.HibernateException; import org.hibernate.LockMode; import org.hibernate.SessionFactory; @@ -28,6 +29,7 @@ import org.hibernate.query.Query; import org.hibernate.query.SelectionQuery; import org.hibernate.query.criteria.HibernateCriteriaBuilder; +import org.hibernate.query.criteria.JpaCriteriaInsert; import org.hibernate.query.criteria.JpaCriteriaInsertSelect; import io.quarkus.arc.Arc; @@ -394,6 +396,30 @@ public Object get(String entityName, Object id, LockMode lockMode) { } } + @Override + public Filter enableFilter(String filterName) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.statelessSession.enableFilter(filterName); + } + } + + @Override + public Filter getEnabledFilter(String filterName) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.statelessSession.getEnabledFilter(filterName); + } + } + + @Override + public void disableFilter(String filterName) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.statelessSession.disableFilter(filterName); + } + } + @Override public String getTenantIdentifier() { try (SessionResult emr = acquireSession()) { @@ -576,6 +602,14 @@ public MutationQuery createMutationQuery(JpaCriteriaInsertSelect insertSelect) { } } + @Override + public MutationQuery createMutationQuery(JpaCriteriaInsert insertSelect) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.statelessSession.createMutationQuery(insertSelect); + } + } + @Override public MutationQuery createNativeMutationQuery(String sqlString) { checkBlocking(); diff --git a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/resources/META-INF/some-persistence.xml b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/resources/META-INF/some-persistence.xml index 9a8b9b174af45..8724cc1b653a1 100644 --- a/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/resources/META-INF/some-persistence.xml +++ b/extensions/panache/hibernate-orm-panache-kotlin/deployment/src/test/resources/META-INF/some-persistence.xml @@ -10,7 +10,7 @@ - + diff --git a/extensions/panache/hibernate-orm-panache/deployment/src/test/resources/META-INF/some-persistence.xml b/extensions/panache/hibernate-orm-panache/deployment/src/test/resources/META-INF/some-persistence.xml index 9a8b9b174af45..8724cc1b653a1 100644 --- a/extensions/panache/hibernate-orm-panache/deployment/src/test/resources/META-INF/some-persistence.xml +++ b/extensions/panache/hibernate-orm-panache/deployment/src/test/resources/META-INF/some-persistence.xml @@ -10,7 +10,7 @@ - + diff --git a/integration-tests/hibernate-orm-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/kotlin/Status.kt b/integration-tests/hibernate-orm-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/kotlin/Status.kt index 1c21f2a2204d3..d9a471e250749 100644 --- a/integration-tests/hibernate-orm-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/kotlin/Status.kt +++ b/integration-tests/hibernate-orm-panache-kotlin/src/main/kotlin/io/quarkus/it/panache/kotlin/Status.kt @@ -1,6 +1,8 @@ package io.quarkus.it.panache.kotlin enum class Status { + // Make sure to keep the ordinal order different from alphabetical order here + // See io.quarkus.it.panache.TestEndpointRunner LIVING, DECEASED } diff --git a/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestEndpointRunner.kt b/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestEndpointRunner.kt index d52aeaebc2ff0..f8607b6d984e8 100644 --- a/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestEndpointRunner.kt +++ b/integration-tests/hibernate-orm-panache-kotlin/src/test/kotlin/io/quarkus/it/panache/TestEndpointRunner.kt @@ -40,7 +40,11 @@ class TestEndpointRunner { con.close() Assertions.assertEquals( - "CHARACTER VARYING", + // The H2 dialect uses native enums by default for @Enumerated(EnumType.STRING) + // We're also checking enum value order here: + // with @Enumerated(EnumType.STRING), enum values should be in alphabetical order + // (which is different from the ordinal order) + "ENUM('DECEASED', 'LIVING')", schema["PERSON2"]?.get("STATUS"), schema.toString() ) diff --git a/integration-tests/jpa-mapping-xml/legacy-library-a/src/main/resources/META-INF/persistence.xml b/integration-tests/jpa-mapping-xml/legacy-library-a/src/main/resources/META-INF/persistence.xml index 0bb292da6bb8a..870897e76a697 100644 --- a/integration-tests/jpa-mapping-xml/legacy-library-a/src/main/resources/META-INF/persistence.xml +++ b/integration-tests/jpa-mapping-xml/legacy-library-a/src/main/resources/META-INF/persistence.xml @@ -8,7 +8,7 @@ - + diff --git a/integration-tests/jpa-mapping-xml/legacy-library-b/src/main/resources/META-INF/persistence.xml b/integration-tests/jpa-mapping-xml/legacy-library-b/src/main/resources/META-INF/persistence.xml index c67574a703136..6711a97e36470 100644 --- a/integration-tests/jpa-mapping-xml/legacy-library-b/src/main/resources/META-INF/persistence.xml +++ b/integration-tests/jpa-mapping-xml/legacy-library-b/src/main/resources/META-INF/persistence.xml @@ -8,7 +8,7 @@ - + diff --git a/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.0/image-metrics.properties b/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.0/image-metrics.properties index 902a32e50a850..fd63c5b2782ea 100644 --- a/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.0/image-metrics.properties +++ b/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.0/image-metrics.properties @@ -1,17 +1,17 @@ # Properties file used by ImageMetricsITCase image_details.total_bytes=88215776 image_details.total_bytes.tolerance=3 -analysis_results.types.reachable=20414 +analysis_results.types.reachable=20556 analysis_results.types.reachable.tolerance=3 -analysis_results.methods.reachable=100917 +analysis_results.methods.reachable=101602 analysis_results.methods.reachable.tolerance=3 -analysis_results.fields.reachable=29906 +analysis_results.fields.reachable=30176 analysis_results.fields.reachable.tolerance=3 -analysis_results.types.reflection=6530 +analysis_results.types.reflection=6585 analysis_results.types.reflection.tolerance=3 -analysis_results.methods.reflection=4781 +analysis_results.methods.reflection=4786 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=143 +analysis_results.fields.reflection=147 analysis_results.fields.reflection.tolerance=3 analysis_results.types.jni=63 analysis_results.types.jni.tolerance=1 diff --git a/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.1/image-metrics.properties b/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.1/image-metrics.properties index c89c4fd99b996..72ad4d86c1d53 100644 --- a/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.1/image-metrics.properties +++ b/integration-tests/jpa-postgresql-withxml/src/test/resources/image-metrics/23.1/image-metrics.properties @@ -1,17 +1,17 @@ # Properties file used by ImageMetricsITCase image_details.total_bytes=91650760 image_details.total_bytes.tolerance=3 -analysis_results.types.reachable=20387 +analysis_results.types.reachable=20867 analysis_results.types.reachable.tolerance=3 -analysis_results.methods.reachable=100956 +analysis_results.methods.reachable=103028 analysis_results.methods.reachable.tolerance=3 -analysis_results.fields.reachable=29789 +analysis_results.fields.reachable=30098 analysis_results.fields.reachable.tolerance=3 -analysis_results.types.reflection=6522 +analysis_results.types.reflection=6705 analysis_results.types.reflection.tolerance=3 analysis_results.methods.reflection=4893 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=163 +analysis_results.fields.reflection=170 analysis_results.fields.reflection.tolerance=3 analysis_results.types.jni=61 analysis_results.types.jni.tolerance=1 diff --git a/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.0/image-metrics.properties b/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.0/image-metrics.properties index 44ddcbd83de40..0ee1ad780c651 100644 --- a/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.0/image-metrics.properties +++ b/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.0/image-metrics.properties @@ -1,17 +1,17 @@ # Properties file used by ImageMetricsITCase image_details.total_bytes=79712248 image_details.total_bytes.tolerance=3 -analysis_results.types.reachable=19441 +analysis_results.types.reachable=19625 analysis_results.types.reachable.tolerance=3 -analysis_results.methods.reachable=96417 +analysis_results.methods.reachable=97338 analysis_results.methods.reachable.tolerance=3 -analysis_results.fields.reachable=27131 +analysis_results.fields.reachable=27443 analysis_results.fields.reachable.tolerance=3 -analysis_results.types.reflection=6060 +analysis_results.types.reflection=6128 analysis_results.types.reflection.tolerance=3 -analysis_results.methods.reflection=4600 +analysis_results.methods.reflection=4608 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=170 +analysis_results.fields.reflection=176 analysis_results.fields.reflection.tolerance=3 analysis_results.types.jni=63 analysis_results.types.jni.tolerance=1 diff --git a/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.1/image-metrics.properties b/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.1/image-metrics.properties index 507eb65104e09..553ae245754f0 100644 --- a/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.1/image-metrics.properties +++ b/integration-tests/jpa-postgresql/src/test/resources/image-metrics/23.1/image-metrics.properties @@ -1,17 +1,17 @@ # Properties file used by ImageMetricsITCase image_details.total_bytes=83036632 image_details.total_bytes.tolerance=3 -analysis_results.types.reachable=19394 +analysis_results.types.reachable=19853 analysis_results.types.reachable.tolerance=3 -analysis_results.methods.reachable=96465 +analysis_results.methods.reachable=98606 analysis_results.methods.reachable.tolerance=3 -analysis_results.fields.reachable=27025 +analysis_results.fields.reachable=27389 analysis_results.fields.reachable.tolerance=3 -analysis_results.types.reflection=6100 +analysis_results.types.reflection=6232 analysis_results.types.reflection.tolerance=3 -analysis_results.methods.reflection=4707 +analysis_results.methods.reflection=4708 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=192 +analysis_results.fields.reflection=201 analysis_results.fields.reflection.tolerance=3 analysis_results.types.jni=61 analysis_results.types.jni.tolerance=1 diff --git a/integration-tests/jpa/README.adoc b/integration-tests/jpa/README.adoc index 8571c1391a9d8..680bfca2f9306 100644 --- a/integration-tests/jpa/README.adoc +++ b/integration-tests/jpa/README.adoc @@ -37,17 +37,17 @@ I am doing a first pass on the properties and I want to propose the following pr * `hibernate.dialect` * `hibernate.show_sql` (and then `hibernate.format_sql` ?) * should show_sql not do System.out but rather a proper log -* `javax.persistence.schema-generation.database.action` +* `jakarta.persistence.schema-generation.database.action` Anything else? I would force the following: -* `javax.persistence.sharedCache.mode` to yes -* `javax.persistence.sql-load-script-source` set to a default file name +* `jakarta.persistence.sharedCache.mode` to yes +* `jakarta.persistence.sql-load-script-source` set to a default file name Questions do we need: -* `javax.persistence.transactionType` +* `jakarta.persistence.transactionType` diff --git a/integration-tests/main/src/main/resources/META-INF/persistence.xml b/integration-tests/main/src/main/resources/META-INF/persistence.xml index 843270ea08740..69b29b2271209 100644 --- a/integration-tests/main/src/main/resources/META-INF/persistence.xml +++ b/integration-tests/main/src/main/resources/META-INF/persistence.xml @@ -26,9 +26,9 @@ Optimistically create the tables; will cause background errors being logged if they already exist, but is practical to retain existing data across runs (or create as needed) --> - + - + diff --git a/integration-tests/main/src/test/resources/image-metrics/23.0/image-metrics.properties b/integration-tests/main/src/test/resources/image-metrics/23.0/image-metrics.properties index 3e835a62b8d4a..2da98333835da 100644 --- a/integration-tests/main/src/test/resources/image-metrics/23.0/image-metrics.properties +++ b/integration-tests/main/src/test/resources/image-metrics/23.0/image-metrics.properties @@ -11,7 +11,7 @@ analysis_results.types.reflection=8927 analysis_results.types.reflection.tolerance=3 analysis_results.methods.reflection=7136 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=438 +analysis_results.fields.reflection=445 analysis_results.fields.reflection.tolerance=3 analysis_results.types.jni=64 analysis_results.types.jni.tolerance=1 diff --git a/integration-tests/main/src/test/resources/image-metrics/23.1/image-metrics.properties b/integration-tests/main/src/test/resources/image-metrics/23.1/image-metrics.properties index e08a94b6e5cb9..c8ba0810c3f9d 100644 --- a/integration-tests/main/src/test/resources/image-metrics/23.1/image-metrics.properties +++ b/integration-tests/main/src/test/resources/image-metrics/23.1/image-metrics.properties @@ -13,7 +13,7 @@ analysis_results.classes.reflection=9118 analysis_results.classes.reflection.tolerance=3 analysis_results.methods.reflection=7741 analysis_results.methods.reflection.tolerance=3 -analysis_results.fields.reflection=480 +analysis_results.fields.reflection=496 analysis_results.fields.reflection.tolerance=3 # TODO: Switch to using analysis_results.types.jni key once we drop support for GraalVM 22.3.0 analysis_results.classes.jni=62