From 80abb44c376578171bc81c8fa0fbc3af4c8dd5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Mon, 18 Nov 2024 09:42:12 +0100 Subject: [PATCH] Upgrade to Hibernate ORM 7.0.0.Beta3 / Reactive 3.0.0.Beta1 --- bom/application/pom.xml | 8 -- .../hibernate/orm/deployment/ClassNames.java | 21 ++-- .../orm/deployment/HibernateOrmProcessor.java | 2 +- .../io/quarkus/hibernate/orm/SchemaUtil.java | 7 +- .../DatabaseOrmCompatibilityVersionTest.java | 3 +- .../UnsupportedPropertiesTest.java | 3 +- .../orm/deployment/ClassNamesTest.java | 5 +- .../ApplicationScopedInterceptorTest.java | 4 +- .../interceptor/DependentInterceptorTest.java | 4 +- .../TransactionScopedInterceptorTest.java | 4 +- ...ltiplePersistenceUnitsInterceptorTest.java | 6 +- .../StatelessSessionLazyDelegator.java | 25 ++++ .../FastBootEntityManagerFactoryBuilder.java | 6 - .../runtime/boot/FastBootMetadataBuilder.java | 10 +- .../QuarkusPersistenceUnitDescriptor.java | 29 +++-- .../customized/QuarkusProxyFactory.java | 4 +- .../PrevalidatedQuarkusMetadata.java | 4 +- .../schema/SchemaManagementIntegrator.java | 7 -- .../service/FlatClassLoaderService.java | 3 +- .../QuarkusRuntimeInitDialectFactory.java | 6 +- .../session/TransactionScopedSession.java | 112 +++++++----------- .../TransactionScopedStatelessSession.java | 40 +++++++ .../HibernateReactiveProcessor.java | 2 +- .../hibernate/reactive/SchemaUtil.java | 7 +- ...figuredReactiveServiceRegistryBuilder.java | 4 - ...eactiveHibernateInitiatorListProvider.java | 4 - .../mapping/xml/legacy/app/SchemaUtil.java | 7 +- .../mapping/xml/modern/app/SchemaUtil.java | 7 +- pom.xml | 8 +- 29 files changed, 187 insertions(+), 165 deletions(-) diff --git a/bom/application/pom.xml b/bom/application/pom.xml index 8d1268f2f2f8c..188af09f29902 100644 --- a/bom/application/pom.xml +++ b/bom/application/pom.xml @@ -5349,14 +5349,6 @@ org.hibernate.orm hibernate-core ${hibernate-orm.version} - - - - - org.hibernate.orm diff --git a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java index 6928d9aa6992e..9642f31f6bc92 100644 --- a/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java +++ b/extensions/hibernate-orm/deployment/src/main/java/io/quarkus/hibernate/orm/deployment/ClassNames.java @@ -73,14 +73,22 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.id.GUIDGenerator"), createConstant("org.hibernate.id.IdentityGenerator"), createConstant("org.hibernate.id.IncrementGenerator"), + createConstant("org.hibernate.id.NativeGenerator"), createConstant("org.hibernate.id.SelectGenerator"), createConstant("org.hibernate.id.UUIDGenerator"), createConstant("org.hibernate.id.UUIDHexGenerator"), createConstant("org.hibernate.id.enhanced.SequenceStyleGenerator"), createConstant("org.hibernate.id.enhanced.TableGenerator"), - createConstant("org.hibernate.id.uuid.UuidGenerator")); + createConstant("org.hibernate.id.uuid.UuidGenerator"), + createConstant("org.hibernate.tuple.entity.CompositeGeneratorBuilder$CompositeBeforeExecutionGenerator"), + createConstant("org.hibernate.tuple.entity.CompositeGeneratorBuilder$CompositeOnExecutionGenerator"), + createConstant("org.hibernate.tuple.entity.CompositeGeneratorBuilder$DummyGenerator")); public static final List PACKAGE_ANNOTATIONS = List.of( + createConstant("jakarta.persistence.SequenceGenerator"), + createConstant("jakarta.persistence.SequenceGenerators"), + createConstant("jakarta.persistence.TableGenerator"), + createConstant("jakarta.persistence.TableGenerators"), createConstant("org.hibernate.annotations.CollectionTypeRegistration"), createConstant("org.hibernate.annotations.CompositeTypeRegistration"), createConstant("org.hibernate.annotations.CompositeTypeRegistrations"), @@ -107,11 +115,8 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.annotations.NamedNativeQuery"), createConstant("org.hibernate.annotations.NamedQueries"), createConstant("org.hibernate.annotations.NamedQuery"), - createConstant("jakarta.persistence.SequenceGenerator"), - createConstant("jakarta.persistence.SequenceGenerators"), + createConstant("org.hibernate.annotations.NativeGenerator"), createConstant("org.hibernate.annotations.SoftDelete"), - createConstant("jakarta.persistence.TableGenerator"), - createConstant("jakarta.persistence.TableGenerators"), createConstant("org.hibernate.annotations.TypeRegistration"), createConstant("org.hibernate.annotations.TypeRegistrations")); @@ -215,6 +220,7 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.annotations.AnyDiscriminator"), createConstant("org.hibernate.annotations.AnyDiscriminatorValue"), createConstant("org.hibernate.annotations.AnyDiscriminatorValues"), + createConstant("org.hibernate.annotations.AnyDiscriminatorImplicitValues"), createConstant("org.hibernate.annotations.AnyKeyJavaClass"), createConstant("org.hibernate.annotations.AnyKeyJavaType"), createConstant("org.hibernate.annotations.AnyKeyJdbcType"), @@ -250,7 +256,6 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.annotations.ConcreteProxy"), createConstant("org.hibernate.annotations.ConverterRegistration"), createConstant("org.hibernate.annotations.ConverterRegistrations"), - createConstant("org.hibernate.boot.models.Copied"), createConstant("org.hibernate.annotations.CreationTimestamp"), createConstant("org.hibernate.annotations.CurrentTimestamp"), createConstant("org.hibernate.annotations.DialectOverride$Check"), @@ -269,8 +274,6 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.annotations.DialectOverride$GeneratedColumns"), createConstant("org.hibernate.annotations.DialectOverride$JoinFormula"), createConstant("org.hibernate.annotations.DialectOverride$JoinFormulas"), - createConstant("org.hibernate.annotations.DialectOverride$OrderBy"), - createConstant("org.hibernate.annotations.DialectOverride$OrderBys"), createConstant("org.hibernate.annotations.DialectOverride$OverridesAnnotation"), createConstant("org.hibernate.annotations.DialectOverride$SQLDelete"), createConstant("org.hibernate.annotations.DialectOverride$SQLDeleteAll"), @@ -344,13 +347,13 @@ private static DotName createConstant(String fqcn) { createConstant("org.hibernate.annotations.NamedQueries"), createConstant("org.hibernate.annotations.NamedQuery"), createConstant("org.hibernate.annotations.Nationalized"), + createConstant("org.hibernate.annotations.NativeGenerator"), createConstant("org.hibernate.annotations.NaturalId"), createConstant("org.hibernate.annotations.NaturalIdCache"), createConstant("org.hibernate.annotations.NotFound"), createConstant("org.hibernate.annotations.OnDelete"), createConstant("org.hibernate.annotations.OptimisticLock"), createConstant("org.hibernate.annotations.OptimisticLocking"), - createConstant("org.hibernate.annotations.OrderBy"), createConstant("org.hibernate.annotations.ParamDef"), createConstant("org.hibernate.annotations.Parameter"), createConstant("org.hibernate.annotations.Parent"), 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 c115d1151eeff..c5ee0540fa3e7 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 @@ -36,9 +36,9 @@ import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.inject.Default; +import jakarta.persistence.PersistenceUnitTransactionType; import jakarta.persistence.SharedCacheMode; import jakarta.persistence.ValidationMode; -import jakarta.persistence.spi.PersistenceUnitTransactionType; import jakarta.xml.bind.JAXBElement; import org.hibernate.boot.archive.scan.spi.ClassDescriptor; diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/SchemaUtil.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/SchemaUtil.java index e2f936ecdf31c..12d9562409b6f 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/SchemaUtil.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/SchemaUtil.java @@ -11,7 +11,6 @@ import org.hibernate.metamodel.MappingMetamodel; import org.hibernate.metamodel.mapping.SelectableConsumer; import org.hibernate.metamodel.mapping.SelectableMapping; -import org.hibernate.persister.entity.AbstractEntityPersister; import org.hibernate.persister.entity.EntityPersister; public final class SchemaUtil { @@ -21,9 +20,9 @@ private SchemaUtil() { public static Set getColumnNames(EntityManagerFactory entityManagerFactory, Class entityType) { Set result = new HashSet<>(); - AbstractEntityPersister persister = (AbstractEntityPersister) entityManagerFactory - .unwrap(SessionFactoryImplementor.class) - .getMetamodel().entityPersister(entityType); + var persister = entityManagerFactory.unwrap(SessionFactoryImplementor.class) + .getMappingMetamodel() + .getEntityDescriptor(entityType); if (persister == null) { return result; } diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/databaseormcompatibility/DatabaseOrmCompatibilityVersionTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/databaseormcompatibility/DatabaseOrmCompatibilityVersionTest.java index 021f341bdd22a..882e3e04175b0 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/databaseormcompatibility/DatabaseOrmCompatibilityVersionTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/databaseormcompatibility/DatabaseOrmCompatibilityVersionTest.java @@ -74,7 +74,8 @@ public class DatabaseOrmCompatibilityVersionTest { @Test public void testPropertiesPropagatedToStaticInit() { - assertThat(SettingsSpyingIdentifierGenerator.collectedSettings).hasSize(1); + // Two sets of settings: 0 is static init, 1 is runtime init. + assertThat(SettingsSpyingIdentifierGenerator.collectedSettings).hasSize(2); Map settings = SettingsSpyingIdentifierGenerator.collectedSettings.get(0); assertThat(settings).containsAllEntriesOf(Map.of( AvailableSettings.TIMEZONE_DEFAULT_STORAGE, "NORMALIZE", diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/unsupportedproperties/UnsupportedPropertiesTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/unsupportedproperties/UnsupportedPropertiesTest.java index d5539e8e9a192..ab6d11c8c564b 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/unsupportedproperties/UnsupportedPropertiesTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/config/unsupportedproperties/UnsupportedPropertiesTest.java @@ -96,7 +96,8 @@ public class UnsupportedPropertiesTest { @Test public void testPropertiesPropagatedToStaticInit() { - assertThat(SettingsSpyingIdentifierGenerator.collectedSettings).hasSize(1); + // Two sets of settings: 0 is static init, 1 is runtime init. + assertThat(SettingsSpyingIdentifierGenerator.collectedSettings).hasSize(2); Map settings = SettingsSpyingIdentifierGenerator.collectedSettings.get(0); assertThat(settings) .containsEntry("hibernate.some.unknown.key.static-and-runtime", "some-value-1") diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ClassNamesTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ClassNamesTest.java index 66ca64943ca52..e1ca9495e77c2 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ClassNamesTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/deployment/ClassNamesTest.java @@ -32,6 +32,8 @@ import org.junit.jupiter.api.Test; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.MethodSource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import io.quarkus.deployment.index.IndexWrapper; import io.quarkus.deployment.index.IndexingUtil; @@ -45,6 +47,7 @@ public class ClassNamesTest { private static final DotName RETENTION = DotName.createSimple(Retention.class.getName()); private static final DotName TARGET = DotName.createSimple(Target.class.getName()); + private static final Logger log = LoggerFactory.getLogger(ClassNamesTest.class); private static Index jpaIndex; private static Index hibernateIndex; @@ -149,7 +152,7 @@ public void testNoMissingJdbcJavaTypeClass() { List typeParams = JandexUtil.resolveTypeParameters(basicJavaTypeImplInfo.name(), basicJavaTypeName, hibernateAndJdkIndex); Type jdbcJavaType = typeParams.get(0); - if (jdbcJavaType.kind() == Type.Kind.CLASS) { + if (jdbcJavaType.kind() == Type.Kind.CLASS || jdbcJavaType.kind() == Type.Kind.PARAMETERIZED_TYPE) { jdbcJavaTypeNames.add(jdbcJavaType.name()); } } diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/ApplicationScopedInterceptorTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/ApplicationScopedInterceptorTest.java index a12206a5fd781..3d672a2627efd 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/ApplicationScopedInterceptorTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/ApplicationScopedInterceptorTest.java @@ -14,7 +14,7 @@ import jakarta.transaction.UserTransaction; import org.hibernate.CallbackException; -import org.hibernate.EmptyInterceptor; +import org.hibernate.Interceptor; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.type.Type; @@ -113,7 +113,7 @@ public MyEntity(int id) { } @PersistenceUnitExtension // @ApplicationScoped is the default - public static class ApplicationScopedInterceptor extends EmptyInterceptor { + public static class ApplicationScopedInterceptor implements Interceptor { private static final List instances = Collections.synchronizedList(new ArrayList<>()); private static final List loadedIds = Collections.synchronizedList(new ArrayList<>()); diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/DependentInterceptorTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/DependentInterceptorTest.java index 89e104be61520..3b1a3a355c455 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/DependentInterceptorTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/DependentInterceptorTest.java @@ -15,7 +15,7 @@ import jakarta.transaction.UserTransaction; import org.hibernate.CallbackException; -import org.hibernate.EmptyInterceptor; +import org.hibernate.Interceptor; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.type.Type; @@ -116,7 +116,7 @@ public MyEntity(int id) { @PersistenceUnitExtension @Dependent - public static class DependentInterceptor extends EmptyInterceptor { + public static class DependentInterceptor implements Interceptor { private static final List instances = Collections.synchronizedList(new ArrayList<>()); private static final List loadedIds = Collections.synchronizedList(new ArrayList<>()); diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/TransactionScopedInterceptorTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/TransactionScopedInterceptorTest.java index f40097ab4c931..30037ff2ed292 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/TransactionScopedInterceptorTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/interceptor/TransactionScopedInterceptorTest.java @@ -16,7 +16,7 @@ import jakarta.transaction.UserTransaction; import org.hibernate.CallbackException; -import org.hibernate.EmptyInterceptor; +import org.hibernate.Interceptor; import org.hibernate.Session; import org.hibernate.SessionFactory; import org.hibernate.type.Type; @@ -118,7 +118,7 @@ public MyEntity(int id) { @PersistenceUnitExtension @TransactionScoped - public static class TransactionScopedInterceptor extends EmptyInterceptor { + public static class TransactionScopedInterceptor implements Interceptor { private static final List instances = Collections.synchronizedList(new ArrayList<>()); private static final List loadedIds = Collections.synchronizedList(new ArrayList<>()); diff --git a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsInterceptorTest.java b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsInterceptorTest.java index f97a17e6ce04e..b1fe19e68b155 100644 --- a/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsInterceptorTest.java +++ b/extensions/hibernate-orm/deployment/src/test/java/io/quarkus/hibernate/orm/multiplepersistenceunits/MultiplePersistenceUnitsInterceptorTest.java @@ -10,7 +10,7 @@ import jakarta.transaction.UserTransaction; import org.hibernate.CallbackException; -import org.hibernate.EmptyInterceptor; +import org.hibernate.Interceptor; import org.hibernate.Session; import org.hibernate.type.Type; import org.junit.jupiter.api.BeforeEach; @@ -105,7 +105,7 @@ public void test() throws Exception { } @PersistenceUnitExtension - public static class MyDefaultPUInterceptor extends EmptyInterceptor { + public static class MyDefaultPUInterceptor implements Interceptor { private static final List instances = Collections.synchronizedList(new ArrayList<>()); private static final List loadedIds = Collections.synchronizedList(new ArrayList<>()); @@ -124,7 +124,7 @@ public boolean onLoad(Object entity, Object id, Object[] state, String[] propert } @PersistenceUnitExtension("inventory") - public static class MyInventoryPUInterceptor extends EmptyInterceptor { + public static class MyInventoryPUInterceptor implements Interceptor { private static final List instances = Collections.synchronizedList(new ArrayList<>()); private static final List loadedIds = Collections.synchronizedList(new ArrayList<>()); 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 5d34b0dd026ec..4b5ec23cadc86 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 @@ -54,6 +54,11 @@ public Object insert(String entityName, Object entity) { return delegate.get().insert(entityName, entity); } + @Override + public void insertMultiple(List entities) { + delegate.get().insertMultiple(entities); + } + @Override public void update(Object entity) { delegate.get().update(entity); @@ -64,6 +69,11 @@ public void update(String entityName, Object entity) { delegate.get().update(entityName, entity); } + @Override + public void updateMultiple(List entities) { + delegate.get().updateMultiple(entities); + } + @Override public void delete(Object entity) { delegate.get().delete(entity); @@ -74,6 +84,11 @@ public void delete(String entityName, Object entity) { delegate.get().delete(entityName, entity); } + @Override + public void deleteMultiple(List entities) { + delegate.get().deleteMultiple(entities); + } + @Override public Object get(String entityName, Object id) { return delegate.get().get(entityName, id); @@ -84,6 +99,11 @@ public T get(Class entityClass, Object id) { return delegate.get().get(entityClass, id); } + @Override + public List getMultiple(Class entityClass, List ids) { + return delegate.get().getMultiple(entityClass, ids); + } + @Override public Object get(String entityName, Object id, LockMode lockMode) { return delegate.get().get(entityName, id, lockMode); @@ -433,6 +453,11 @@ public void upsert(String entityName, Object entity) { delegate.get().upsert(entityName, entity); } + @Override + public void upsertMultiple(List entities) { + delegate.get().upsertMultiple(entities); + } + @Override public T get(EntityGraph graph, GraphSemantic graphSemantic, Object id) { return delegate.get().get(graph, graphSemantic, id); diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java index 21fdd58b007f8..7a26da719170a 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/FastBootEntityManagerFactoryBuilder.java @@ -143,12 +143,6 @@ protected void populate(String persistenceUnitName, SessionFactoryOptionsBuilder options.disableJtaTransactionAccess(); } - final boolean allowRefreshDetachedEntity = runtimeSettings.getBoolean( - org.hibernate.cfg.AvailableSettings.ALLOW_REFRESH_DETACHED_ENTITY); - if (!allowRefreshDetachedEntity) { - options.disableRefreshDetachedEntity(); - } - //Check for use of deprecated org.hibernate.jpa.AvailableSettings.SESSION_FACTORY_OBSERVER final Object legacyObserver = runtimeSettings.get("hibernate.ejb.session_factory_observer"); if (legacyObserver != null) { 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 b6a41b9b0b42e..a20221a86fa72 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 @@ -14,7 +14,7 @@ import static org.hibernate.cfg.AvailableSettings.URL; import static org.hibernate.cfg.AvailableSettings.USER; import static org.hibernate.cfg.AvailableSettings.XML_MAPPING_ENABLED; -import static org.hibernate.internal.HEMLogging.messageLogger; +import static org.hibernate.internal.CoreLogging.messageLogger; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; @@ -30,7 +30,7 @@ import java.util.stream.Collectors; import jakarta.persistence.PersistenceException; -import jakarta.persistence.spi.PersistenceUnitTransactionType; +import jakarta.persistence.PersistenceUnitTransactionType; import org.hibernate.boot.CacheRegionDefinition; import org.hibernate.boot.MetadataBuilder; @@ -50,7 +50,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.dialect.spi.DialectFactory; import org.hibernate.integrator.spi.Integrator; -import org.hibernate.internal.EntityManagerMessageLogger; +import org.hibernate.internal.CoreMessageLogger; import org.hibernate.internal.util.StringHelper; import org.hibernate.jpa.boot.internal.StandardJpaScanEnvironmentImpl; import org.hibernate.jpa.boot.spi.JpaSettings; @@ -98,7 +98,7 @@ public class FastBootMetadataBuilder { @Deprecated private static final String ALLOW_ENHANCEMENT_AS_PROXY = "hibernate.bytecode.allow_enhancement_as_proxy"; - private static final EntityManagerMessageLogger LOG = messageLogger(FastBootMetadataBuilder.class); + private static final CoreMessageLogger LOG = messageLogger(FastBootMetadataBuilder.class); private final PersistenceUnitDescriptor persistenceUnit; private final BuildTimeSettings buildTimeSettings; @@ -593,7 +593,7 @@ private static void applyTransactionProperties(PersistenceUnitDescriptor persist PersistenceUnitTransactionType transactionType = PersistenceUnitTransactionTypeHelper .interpretTransactionType(configurationValues.get(JPA_TRANSACTION_TYPE)); if (transactionType == null) { - transactionType = persistenceUnit.getTransactionType(); + transactionType = persistenceUnit.getPersistenceUnitTransactionType(); } if (transactionType == null) { // is it more appropriate to have this be based on bootstrap entry point (EE vs SE)? diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java index 22fb6688cdf71..b2bf0d11e916d 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/boot/QuarkusPersistenceUnitDescriptor.java @@ -6,13 +6,14 @@ import java.util.Objects; import java.util.Properties; +import jakarta.persistence.PersistenceUnitTransactionType; import jakarta.persistence.SharedCacheMode; import jakarta.persistence.ValidationMode; -import jakarta.persistence.spi.PersistenceUnitTransactionType; import org.hibernate.bytecode.enhance.spi.EnhancementContext; import org.hibernate.bytecode.spi.ClassTransformer; import org.hibernate.jpa.boot.spi.PersistenceUnitDescriptor; +import org.hibernate.jpa.internal.util.PersistenceUnitTransactionTypeHelper; import io.quarkus.runtime.annotations.RecordableConstructor; @@ -25,21 +26,21 @@ public final class QuarkusPersistenceUnitDescriptor implements PersistenceUnitDe private final String configurationName; private final String providerClassName; private final boolean useQuotedIdentifiers; - private final PersistenceUnitTransactionType transactionType; + private final PersistenceUnitTransactionType persistenceUnitTransactionType; private final ValidationMode validationMode; private final SharedCacheMode sharedCacheMode; private final List managedClassNames; private final Properties properties; public QuarkusPersistenceUnitDescriptor(String name, String configurationName, - PersistenceUnitTransactionType transactionType, + PersistenceUnitTransactionType persistenceUnitTransactionType, List managedClassNames, Properties properties) { this.name = name; this.configurationName = configurationName; this.providerClassName = null; this.useQuotedIdentifiers = false; - this.transactionType = transactionType; + this.persistenceUnitTransactionType = persistenceUnitTransactionType; this.validationMode = null; this.sharedCacheMode = null; this.managedClassNames = managedClassNames; @@ -55,14 +56,14 @@ public QuarkusPersistenceUnitDescriptor(String name, String configurationName, @RecordableConstructor public QuarkusPersistenceUnitDescriptor(String name, String configurationName, String providerClassName, boolean useQuotedIdentifiers, - PersistenceUnitTransactionType transactionType, + PersistenceUnitTransactionType persistenceUnitTransactionType, ValidationMode validationMode, SharedCacheMode sharedCacheMode, List managedClassNames, Properties properties) { this.name = name; this.configurationName = configurationName; this.providerClassName = providerClassName; this.useQuotedIdentifiers = useQuotedIdentifiers; - this.transactionType = transactionType; + this.persistenceUnitTransactionType = persistenceUnitTransactionType; this.validationMode = validationMode; this.sharedCacheMode = sharedCacheMode; this.managedClassNames = managedClassNames; @@ -86,7 +87,7 @@ public static QuarkusPersistenceUnitDescriptor validateAndReadFrom(PersistenceUn verifyIgnoredFields(toClone); return new QuarkusPersistenceUnitDescriptor(toClone.getName(), toClone.getName(), toClone.getProviderClassName(), toClone.isUseQuotedIdentifiers(), - toClone.getTransactionType(), toClone.getValidationMode(), toClone.getSharedCacheMode(), + toClone.getPersistenceUnitTransactionType(), toClone.getValidationMode(), toClone.getSharedCacheMode(), Collections.unmodifiableList(toClone.getManagedClassNames()), toClone.getProperties()); } @@ -121,8 +122,15 @@ public boolean isExcludeUnlistedClasses() { } @Override - public PersistenceUnitTransactionType getTransactionType() { - return transactionType; + public PersistenceUnitTransactionType getPersistenceUnitTransactionType() { + return persistenceUnitTransactionType; + } + + @Override + @Deprecated + @SuppressWarnings("removal") + public jakarta.persistence.spi.PersistenceUnitTransactionType getTransactionType() { + return PersistenceUnitTransactionTypeHelper.toDeprecatedForm(getPersistenceUnitTransactionType()); } @Override @@ -209,7 +217,8 @@ private static void verifyIgnoredFields(final PersistenceUnitDescriptor toClone) @Override public String toString() { return "PersistenceUnitDescriptor{" + "name='" + name + '\'' + ", providerClassName='" + providerClassName - + '\'' + ", useQuotedIdentifiers=" + useQuotedIdentifiers + ", transactionType=" + transactionType + + '\'' + ", useQuotedIdentifiers=" + useQuotedIdentifiers + ", transactionType=" + + persistenceUnitTransactionType + ", validationMode=" + validationMode + ", sharedCachemode=" + sharedCacheMode + ", managedClassNames=" + managedClassNames + ", properties=" + properties + '}'; } diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/customized/QuarkusProxyFactory.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/customized/QuarkusProxyFactory.java index e6321bdb460fc..2a587db45fde3 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/customized/QuarkusProxyFactory.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/customized/QuarkusProxyFactory.java @@ -93,7 +93,9 @@ public HibernateProxy getProxy( ((ProxyConfiguration) proxy).$$_hibernate_set_interceptor(interceptor); return proxy; } catch (Throwable t) { - String logMessage = LOG.bytecodeEnhancementFailed(entityName); + String logMessage = "Bytecode enhancement failed for class '" + entityName + + "' (it might be due to the Java module system preventing Hibernate ORM from defining an enhanced class in the same package" + + " - in this case, the class should be opened and exported to Hibernate ORM)"; LOG.error(logMessage, t); throw new HibernateException(logMessage, t); } diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/PrevalidatedQuarkusMetadata.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/PrevalidatedQuarkusMetadata.java index ffb819bae9adf..85ad1e2a44119 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/PrevalidatedQuarkusMetadata.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/recording/PrevalidatedQuarkusMetadata.java @@ -267,8 +267,8 @@ public SqmFunctionRegistry getFunctionRegistry() { } @Override - public NamedObjectRepository buildNamedQueryRepository(SessionFactoryImplementor sessionFactory) { - return metadata.buildNamedQueryRepository(sessionFactory); + public NamedObjectRepository buildNamedQueryRepository() { + return metadata.buildNamedQueryRepository(); } @Override diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java index 93f88a16e3073..eb9c954d2b6f1 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/schema/SchemaManagementIntegrator.java @@ -19,14 +19,12 @@ import org.hibernate.service.spi.SessionFactoryServiceRegistry; import org.hibernate.tool.schema.SourceType; import org.hibernate.tool.schema.TargetType; -import org.hibernate.tool.schema.internal.DefaultSchemaFilter; import org.hibernate.tool.schema.internal.exec.ScriptTargetOutputToWriter; import org.hibernate.tool.schema.spi.CommandAcceptanceException; import org.hibernate.tool.schema.spi.ContributableMatcher; import org.hibernate.tool.schema.spi.ExceptionHandler; import org.hibernate.tool.schema.spi.ExecutionOptions; import org.hibernate.tool.schema.spi.SchemaDropper; -import org.hibernate.tool.schema.spi.SchemaFilter; import org.hibernate.tool.schema.spi.SchemaManagementException; import org.hibernate.tool.schema.spi.SchemaManagementTool; import org.hibernate.tool.schema.spi.SchemaMigrator; @@ -223,11 +221,6 @@ public void handleException(CommandAcceptanceException exception) { } }; } - - @Override - public SchemaFilter getSchemaFilter() { - return DefaultSchemaFilter.INSTANCE; - } } private static class SimpleSourceDescriptor implements SourceDescriptor { diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/FlatClassLoaderService.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/FlatClassLoaderService.java index c15ac900d249c..a238a385b1d01 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/FlatClassLoaderService.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/FlatClassLoaderService.java @@ -93,8 +93,7 @@ public Collection loadJavaServices(Class serviceContract) { } @Override - @SuppressWarnings("rawtypes") - public T generateProxy(InvocationHandler handler, Class... interfaces) { + public T generateProxy(InvocationHandler handler, Class... interfaces) { throw new AssertionFailure("Not implemented! generateProxy(InvocationHandler handler, Class... interfaces)"); } diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusRuntimeInitDialectFactory.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusRuntimeInitDialectFactory.java index 5924d80eac29b..113af3481f94c 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusRuntimeInitDialectFactory.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusRuntimeInitDialectFactory.java @@ -1,6 +1,6 @@ package io.quarkus.hibernate.orm.runtime.service; -import static org.hibernate.internal.HEMLogging.messageLogger; +import static org.hibernate.internal.CoreLogging.messageLogger; import java.sql.SQLException; import java.util.Locale; @@ -13,7 +13,7 @@ import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.dialect.spi.DialectFactory; import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfoSource; -import org.hibernate.internal.EntityManagerMessageLogger; +import org.hibernate.internal.CoreMessageLogger; import io.quarkus.datasource.common.runtime.DataSourceUtil; import io.quarkus.hibernate.orm.runtime.HibernateOrmRuntimeConfig; @@ -27,7 +27,7 @@ * @see QuarkusStaticInitDialectFactory */ public class QuarkusRuntimeInitDialectFactory implements DialectFactory { - private static final EntityManagerMessageLogger LOG = messageLogger(QuarkusRuntimeInitDialectFactory.class); + private static final CoreMessageLogger LOG = messageLogger(QuarkusRuntimeInitDialectFactory.class); private final String persistenceUnitName; private final boolean isFromPersistenceXml; private final Dialect dialect; 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 541111b30cd01..5dac6326c35b7 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 @@ -7,6 +7,8 @@ import jakarta.enterprise.inject.Instance; import jakarta.persistence.CacheRetrieveMode; import jakarta.persistence.CacheStoreMode; +import jakarta.persistence.ConnectionConsumer; +import jakarta.persistence.ConnectionFunction; import jakarta.persistence.EntityGraph; import jakarta.persistence.EntityManagerFactory; import jakarta.persistence.FindOption; @@ -223,6 +225,30 @@ public T find(EntityGraph entityGraph, Object primaryKey, FindOption... o } } + @Override + public T find(Class entityType, Object id, LockOptions lockOptions) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.session.find(entityType, id, lockOptions); + } + } + + @Override + public T find(Class entityType, Object id, LockMode lockMode) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.session.find(entityType, id, lockMode); + } + } + + @Override + public List findMultiple(Class entityType, List ids, FindOption... options) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.session.findMultiple(entityType, ids, options); + } + } + @Override public T getReference(Class entityClass, Object primaryKey) { checkBlocking(); @@ -744,60 +770,6 @@ public void evict(Object object) { } } - @Deprecated - @Override - public T load(Class theClass, Object id, LockMode lockMode) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(theClass, id, lockMode); - } - } - - @Deprecated - @Override - public T load(Class theClass, Object id, LockOptions lockOptions) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(theClass, id, lockOptions); - } - } - - @Deprecated - @Override - public Object load(String entityName, Object id, LockMode lockMode) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(entityName, id, lockMode); - } - } - - @Deprecated - @Override - public Object load(String entityName, Object id, LockOptions lockOptions) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(entityName, id, lockOptions); - } - } - - @Deprecated - @Override - public T load(Class theClass, Object id) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(theClass, id); - } - } - - @Deprecated - @Override - public Object load(String entityName, Object id) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.load(entityName, id); - } - } - @Override public void load(Object object, Object id) { checkBlocking(); @@ -855,14 +827,6 @@ public void lock(Object object, LockOptions lockOptions) { } } - @Override - public void lock(String entityName, Object object, LockMode lockMode) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - emr.session.lock(entityName, object, lockMode); - } - } - @Override public void lock(Object entity, LockModeType lockMode, LockOption... options) { checkBlocking(); @@ -871,14 +835,6 @@ public void lock(Object entity, LockModeType lockMode, LockOption... options) { } } - @Override - public LockRequest buildLockRequest(LockOptions lockOptions) { - checkBlocking(); - try (SessionResult emr = acquireSession()) { - return emr.session.buildLockRequest(lockOptions); - } - } - @Override public void refresh(Object object, LockMode lockMode) { checkBlocking(); @@ -1204,6 +1160,22 @@ public T doReturningWork(ReturningWork work) throws HibernateException { } } + @Override + public void runWithConnection(ConnectionConsumer action) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.session.runWithConnection(action); + } + } + + @Override + public T callWithConnection(ConnectionFunction function) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.session.callWithConnection(function); + } + } + @Deprecated @Override public NativeQuery getNamedNativeQuery(String name) { 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 ef8360bdf70d2..1a98fc410de72 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 @@ -286,6 +286,14 @@ public Object insert(String s, Object o) { } } + @Override + public void insertMultiple(List entities) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.statelessSession.insertMultiple(entities); + } + } + @Override public boolean isOpen() { return true; @@ -322,6 +330,14 @@ public void update(String entityName, Object object) { } } + @Override + public void updateMultiple(List entities) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.statelessSession.updateMultiple(entities); + } + } + @Deprecated @Override public void delete(Object object) { @@ -340,6 +356,14 @@ public void delete(String entityName, Object object) { } } + @Override + public void deleteMultiple(List entities) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.statelessSession.deleteMultiple(entities); + } + } + @Deprecated @Override public void refresh(String entityName, Object object) { @@ -413,6 +437,14 @@ public Object get(String entityName, Object id, LockMode lockMode) { } } + @Override + public List getMultiple(Class entityClass, List ids) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + return emr.statelessSession.getMultiple(entityClass, ids); + } + } + @Override public Filter enableFilter(String filterName) { checkBlocking(); @@ -752,6 +784,14 @@ public void upsert(String entityName, Object entity) { } } + @Override + public void upsertMultiple(List entities) { + checkBlocking(); + try (SessionResult emr = acquireSession()) { + emr.statelessSession.upsertMultiple(entities); + } + } + @Override public T get(EntityGraph graph, GraphSemantic graphSemantic, Object id) { checkBlocking(); 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 4450333466f80..00ce366882a50 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 @@ -25,8 +25,8 @@ import java.util.Set; import java.util.stream.Collectors; +import jakarta.persistence.PersistenceUnitTransactionType; import jakarta.persistence.SharedCacheMode; -import jakarta.persistence.spi.PersistenceUnitTransactionType; import org.hibernate.cfg.AvailableSettings; import org.jboss.logging.Logger; diff --git a/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/SchemaUtil.java b/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/SchemaUtil.java index ffd8be2dfb0e5..aae570dd337ed 100644 --- a/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/SchemaUtil.java +++ b/extensions/hibernate-reactive/deployment/src/test/java/io/quarkus/hibernate/reactive/SchemaUtil.java @@ -11,7 +11,6 @@ import org.hibernate.metamodel.MappingMetamodel; import org.hibernate.metamodel.mapping.SelectableConsumer; import org.hibernate.metamodel.mapping.SelectableMapping; -import org.hibernate.persister.entity.AbstractEntityPersister; import org.hibernate.persister.entity.EntityPersister; public final class SchemaUtil { @@ -21,9 +20,9 @@ private SchemaUtil() { public static Set getColumnNames(EntityManagerFactory entityManagerFactory, Class entityType) { Set result = new HashSet<>(); - AbstractEntityPersister persister = (AbstractEntityPersister) entityManagerFactory - .unwrap(SessionFactoryImplementor.class) - .getMetamodel().entityPersister(entityType); + var persister = entityManagerFactory.unwrap(SessionFactoryImplementor.class) + .getMappingMetamodel() + .getEntityDescriptor(entityType); if (persister == null) { return result; } diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/PreconfiguredReactiveServiceRegistryBuilder.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/PreconfiguredReactiveServiceRegistryBuilder.java index dd231b1af9c29..12a7c40142950 100644 --- a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/PreconfiguredReactiveServiceRegistryBuilder.java +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/PreconfiguredReactiveServiceRegistryBuilder.java @@ -22,7 +22,6 @@ import org.hibernate.persister.internal.PersisterFactoryInitiator; import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator; import org.hibernate.reactive.engine.jdbc.mutation.internal.ReactiveMutationExecutorServiceInitiator; -import org.hibernate.reactive.id.factory.spi.ReactiveIdentifierGeneratorFactoryInitiator; import org.hibernate.reactive.loader.ast.internal.ReactiveBatchLoaderFactoryInitiator; import org.hibernate.reactive.provider.service.NativeParametersHandling; import org.hibernate.reactive.provider.service.NoJtaPlatformInitiator; @@ -234,9 +233,6 @@ private static List> buildQuarkusServiceInitiatorLis serviceInitiators.add(EntityCopyObserverFactoryInitiator.INSTANCE); - // Custom for Hibernate Reactive: - serviceInitiators.add(ReactiveIdentifierGeneratorFactoryInitiator.INSTANCE); - //Custom for Hibernate Reactive: serviceInitiators.add(ReactiveValuesMappingProducerProviderInitiator.INSTANCE); diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/ReactiveHibernateInitiatorListProvider.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/ReactiveHibernateInitiatorListProvider.java index 5946e9b55baf4..a4691fd614457 100644 --- a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/ReactiveHibernateInitiatorListProvider.java +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/boot/registry/ReactiveHibernateInitiatorListProvider.java @@ -16,7 +16,6 @@ import org.hibernate.event.internal.EntityCopyObserverFactoryInitiator; import org.hibernate.persister.internal.PersisterFactoryInitiator; import org.hibernate.property.access.internal.PropertyAccessStrategyResolverInitiator; -import org.hibernate.reactive.id.factory.spi.ReactiveIdentifierGeneratorFactoryInitiator; import org.hibernate.reactive.loader.ast.internal.ReactiveBatchLoaderFactoryInitiator; import org.hibernate.reactive.provider.service.NativeParametersHandling; import org.hibernate.reactive.provider.service.NoJtaPlatformInitiator; @@ -109,9 +108,6 @@ public List> initialInitiatorList() { serviceInitiators.add(EntityCopyObserverFactoryInitiator.INSTANCE); - // Custom for Hibernate Reactive: - serviceInitiators.add(ReactiveIdentifierGeneratorFactoryInitiator.INSTANCE); - //Custom for Hibernate Reactive: serviceInitiators.add(ReactiveValuesMappingProducerProviderInitiator.INSTANCE); diff --git a/integration-tests/jpa-mapping-xml/legacy-app/src/main/java/io/quarkus/it/jpa/mapping/xml/legacy/app/SchemaUtil.java b/integration-tests/jpa-mapping-xml/legacy-app/src/main/java/io/quarkus/it/jpa/mapping/xml/legacy/app/SchemaUtil.java index bf4ede5b91fe5..14bb4691ec995 100644 --- a/integration-tests/jpa-mapping-xml/legacy-app/src/main/java/io/quarkus/it/jpa/mapping/xml/legacy/app/SchemaUtil.java +++ b/integration-tests/jpa-mapping-xml/legacy-app/src/main/java/io/quarkus/it/jpa/mapping/xml/legacy/app/SchemaUtil.java @@ -7,7 +7,6 @@ import jakarta.persistence.EntityManagerFactory; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.persister.entity.AbstractEntityPersister; public final class SchemaUtil { @@ -16,9 +15,9 @@ private SchemaUtil() { public static Set getColumnNames(EntityManagerFactory entityManagerFactory, Class entityType) { Set result = new HashSet<>(); - AbstractEntityPersister persister = (AbstractEntityPersister) entityManagerFactory - .unwrap(SessionFactoryImplementor.class) - .getMetamodel().entityPersister(entityType); + var persister = entityManagerFactory.unwrap(SessionFactoryImplementor.class) + .getMappingMetamodel() + .getEntityDescriptor(entityType); if (persister == null) { return result; } diff --git a/integration-tests/jpa-mapping-xml/modern-app/src/main/java/io/quarkus/it/jpa/mapping/xml/modern/app/SchemaUtil.java b/integration-tests/jpa-mapping-xml/modern-app/src/main/java/io/quarkus/it/jpa/mapping/xml/modern/app/SchemaUtil.java index 6a2bf1e9df028..615bc1660f4e0 100644 --- a/integration-tests/jpa-mapping-xml/modern-app/src/main/java/io/quarkus/it/jpa/mapping/xml/modern/app/SchemaUtil.java +++ b/integration-tests/jpa-mapping-xml/modern-app/src/main/java/io/quarkus/it/jpa/mapping/xml/modern/app/SchemaUtil.java @@ -7,7 +7,6 @@ import jakarta.persistence.EntityManagerFactory; import org.hibernate.engine.spi.SessionFactoryImplementor; -import org.hibernate.persister.entity.AbstractEntityPersister; public final class SchemaUtil { @@ -16,9 +15,9 @@ private SchemaUtil() { public static Set getColumnNames(EntityManagerFactory entityManagerFactory, Class entityType) { Set result = new HashSet<>(); - AbstractEntityPersister persister = (AbstractEntityPersister) entityManagerFactory - .unwrap(SessionFactoryImplementor.class) - .getMetamodel().entityPersister(entityType); + var persister = entityManagerFactory.unwrap(SessionFactoryImplementor.class) + .getMappingMetamodel() + .getEntityDescriptor(entityType); if (persister == null) { return result; } diff --git a/pom.xml b/pom.xml index d77a461e37430..1a35c20271424 100644 --- a/pom.xml +++ b/pom.xml @@ -71,11 +71,11 @@ 0.8.12 6.13.4 5.5.0 - 7.0.0.Beta1 + 7.0.0.Beta3 4.13.0 - 1.14.18 - 0.8.6 - 2.4.2.Final + 1.15.10 + 0.9.3 + 3.0.0.Beta1 8.0.2.Final 7.2.2.Final 7.0.3.Final