diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/loader/ast/internal/ReactiveSingleIdEntityLoaderProvidedQueryImpl.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/loader/ast/internal/ReactiveSingleIdEntityLoaderProvidedQueryImpl.java index f509eb9a2..f2b98a03e 100644 --- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/loader/ast/internal/ReactiveSingleIdEntityLoaderProvidedQueryImpl.java +++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/loader/ast/internal/ReactiveSingleIdEntityLoaderProvidedQueryImpl.java @@ -15,6 +15,7 @@ import org.hibernate.query.named.NamedQueryMemento; import org.hibernate.query.spi.QueryImplementor; import org.hibernate.reactive.loader.ast.spi.ReactiveSingleIdEntityLoader; +import org.hibernate.reactive.query.sql.internal.ReactiveNativeQueryImpl; import jakarta.persistence.Parameter; @@ -51,7 +52,7 @@ public CompletionStage load(Object pkValue, LockOptions lockOptions, Boolean query.setParameter( (Parameter) query.getParameters().iterator().next(), pkValue ); query.setHibernateFlushMode( FlushMode.MANUAL ); - return completedFuture( query.uniqueResult() ); + return (( ReactiveNativeQueryImpl)query).reactiveUnique(); } @Override diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/internal/ReactiveNamedObjectRepositoryImpl.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/internal/ReactiveNamedObjectRepositoryImpl.java index f4d8da437..05dc2e30e 100644 --- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/internal/ReactiveNamedObjectRepositoryImpl.java +++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/query/internal/ReactiveNamedObjectRepositoryImpl.java @@ -105,7 +105,7 @@ public NamedQueryMemento resolve( SessionFactoryImplementor sessionFactory, MetadataImplementor bootMetamodel, String registrationName) { - return delegate.resolve( sessionFactory, bootMetamodel, registrationName ); + return new ReactiveNamedNativeQueryMemento( (NamedNativeQueryMemento)delegate.resolve( sessionFactory, bootMetamodel, registrationName ) ); } @Override