diff --git a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusStaticInitDialectFactory.java b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusStaticInitDialectFactory.java index 6f345505e81ad..b344a86255c7a 100644 --- a/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusStaticInitDialectFactory.java +++ b/extensions/hibernate-orm/runtime/src/main/java/io/quarkus/hibernate/orm/runtime/service/QuarkusStaticInitDialectFactory.java @@ -14,7 +14,7 @@ * the same as Hibernate ORM's default one except it records the dialect * so that we can reuse it at runtime init. */ -public final class QuarkusStaticInitDialectFactory extends DialectFactoryImpl +public class QuarkusStaticInitDialectFactory extends DialectFactoryImpl implements DialectFactory, ServiceRegistryAwareService { private Dialect dialect; 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 7334d7f96b905..339379f5c2375 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 @@ -34,9 +34,9 @@ import io.quarkus.hibernate.orm.runtime.service.QuarkusImportSqlCommandExtractorInitiator; import io.quarkus.hibernate.orm.runtime.service.QuarkusMutableIdentifierGeneratorFactoryInitiator; import io.quarkus.hibernate.orm.runtime.service.QuarkusRegionFactoryInitiator; -import io.quarkus.hibernate.orm.runtime.service.QuarkusStaticInitDialectFactoryInitiator; import io.quarkus.hibernate.orm.runtime.service.StandardHibernateORMInitiatorListProvider; import io.quarkus.hibernate.reactive.runtime.customized.QuarkusNoJdbcConnectionProviderInitiator; +import io.quarkus.hibernate.reactive.runtime.customized.QuarkusReactiveDialectFactoryInitiator; /** * Defines the initial list of StandardServiceInitiator instances used to initialize the @@ -86,8 +86,8 @@ public List> initialInitiatorList() { serviceInitiators.add(MultiTenantConnectionProviderInitiator.INSTANCE); serviceInitiators.add(DialectResolverInitiator.INSTANCE); - // Custom Quarkus implementation ! - serviceInitiators.add(QuarkusStaticInitDialectFactoryInitiator.INSTANCE); + // Custom Quarkus V Reactive implementation ! + serviceInitiators.add(QuarkusReactiveDialectFactoryInitiator.INSTANCE); // Default implementation serviceInitiators.add(BatchBuilderInitiator.INSTANCE); diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/QuarkusReactiveDialectFactoryInitiator.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/QuarkusReactiveDialectFactoryInitiator.java new file mode 100644 index 0000000000000..4e3d3bf3fd9b1 --- /dev/null +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/QuarkusReactiveDialectFactoryInitiator.java @@ -0,0 +1,22 @@ +package io.quarkus.hibernate.reactive.runtime.customized; + +import java.util.Map; + +import org.hibernate.boot.registry.StandardServiceInitiator; +import org.hibernate.engine.jdbc.dialect.spi.DialectFactory; +import org.hibernate.service.spi.ServiceRegistryImplementor; + +public final class QuarkusReactiveDialectFactoryInitiator implements StandardServiceInitiator { + + public static final QuarkusReactiveDialectFactoryInitiator INSTANCE = new QuarkusReactiveDialectFactoryInitiator(); + + @Override + public Class getServiceInitiated() { + return DialectFactory.class; + } + + @Override + public DialectFactory initiateService(Map configurationValues, ServiceRegistryImplementor registry) { + return new ReactiveQuarkusStaticInitDialectFactory(); + } +} diff --git a/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/ReactiveQuarkusStaticInitDialectFactory.java b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/ReactiveQuarkusStaticInitDialectFactory.java new file mode 100644 index 0000000000000..277e10113416f --- /dev/null +++ b/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/customized/ReactiveQuarkusStaticInitDialectFactory.java @@ -0,0 +1,30 @@ +package io.quarkus.hibernate.reactive.runtime.customized; + +import java.util.Map; + +import org.hibernate.HibernateException; +import org.hibernate.dialect.Dialect; +import org.hibernate.engine.jdbc.dialect.spi.DialectFactory; +import org.hibernate.engine.jdbc.dialect.spi.DialectResolutionInfoSource; +import org.hibernate.reactive.dialect.ReactiveDialectWrapper; +import org.hibernate.service.spi.ServiceRegistryAwareService; + +import io.quarkus.hibernate.orm.runtime.service.QuarkusStaticInitDialectFactory; + +public class ReactiveQuarkusStaticInitDialectFactory extends QuarkusStaticInitDialectFactory + implements DialectFactory, ServiceRegistryAwareService { + + private Dialect wrapDialect; + + @Override + public Dialect buildDialect(Map map, DialectResolutionInfoSource dialectResolutionInfoSource) + throws HibernateException { + this.wrapDialect = new ReactiveDialectWrapper(super.buildDialect(map, dialectResolutionInfoSource)); + return this.wrapDialect; + } + + @Override + public Dialect getDialect() { + return this.wrapDialect; + } +}