|
33 | 33 | import org.hibernate.query.QueryParameter;
|
34 | 34 | import org.hibernate.query.ResultListTransformer;
|
35 | 35 | import org.hibernate.query.TupleTransformer;
|
| 36 | +import org.hibernate.query.internal.DelegatingDomainQueryExecutionContext; |
36 | 37 | import org.hibernate.query.named.NamedResultSetMappingMemento;
|
37 | 38 | import org.hibernate.query.spi.AbstractSelectionQuery;
|
38 | 39 | import org.hibernate.query.spi.NonSelectQueryPlan;
|
39 | 40 | import org.hibernate.query.spi.QueryInterpretationCache;
|
| 41 | +import org.hibernate.query.spi.QueryOptions; |
40 | 42 | import org.hibernate.query.sql.internal.NativeQueryImpl;
|
41 | 43 | import org.hibernate.query.sql.spi.NamedNativeQueryMemento;
|
42 |
| -import org.hibernate.query.sql.spi.NativeSelectQueryPlan; |
43 | 44 | import org.hibernate.reactive.logging.impl.Log;
|
44 | 45 | import org.hibernate.reactive.logging.impl.LoggerFactory;
|
45 | 46 | import org.hibernate.reactive.query.spi.ReactiveAbstractSelectionQuery;
|
| 47 | +import org.hibernate.reactive.query.spi.ReactiveNativeSelectQueryPlan; |
46 | 48 | import org.hibernate.reactive.query.sql.spi.ReactiveNativeQueryImplementor;
|
47 | 49 | import org.hibernate.reactive.query.sql.spi.ReactiveNonSelectQueryPlan;
|
48 | 50 | import org.hibernate.reactive.query.sqm.spi.ReactiveSelectQueryPlan;
|
| 51 | +import org.hibernate.reactive.sql.results.spi.ReactiveSingleResultConsumer; |
49 | 52 | import org.hibernate.type.BasicTypeReference;
|
50 | 53 |
|
51 | 54 | import jakarta.persistence.AttributeConverter;
|
@@ -190,14 +193,19 @@ public List<R> list() {
|
190 | 193 |
|
191 | 194 | @Override
|
192 | 195 | public CompletionStage<Long> getReactiveResultsCount() {
|
193 |
| - NativeSelectQueryPlan<Long> countQueryPlan = createCountQueryPlan(); |
194 |
| - return selectionQueryDelegate |
195 |
| - .getReactiveResultsCount(null, this ); |
| 196 | + final DelegatingDomainQueryExecutionContext context = new DelegatingDomainQueryExecutionContext( this ) { |
| 197 | + @Override |
| 198 | + public QueryOptions getQueryOptions() { |
| 199 | + return QueryOptions.NONE; |
| 200 | + } |
| 201 | + }; |
| 202 | + |
| 203 | + return createCountQueryPlan().reactiveExecuteQuery( context, new ReactiveSingleResultConsumer<>() ); |
196 | 204 | }
|
197 | 205 |
|
198 | 206 | @Override
|
199 |
| - protected NativeSelectQueryPlan<Long> createCountQueryPlan() { |
200 |
| - return super.createCountQueryPlan(); |
| 207 | + protected ReactiveNativeSelectQueryPlan<Long> createCountQueryPlan() { |
| 208 | + return (ReactiveNativeSelectQueryPlan<Long>) super.createCountQueryPlan(); |
201 | 209 | }
|
202 | 210 |
|
203 | 211 | @Override
|
|
0 commit comments