|
41 | 41 | @Incubating |
42 | 42 | public interface JdbcSelectExecutor { |
43 | 43 |
|
44 | | - /** |
45 | | - * @since 6.4 |
46 | | - * @deprecated Use {@link #executeQuery(JdbcOperationQuerySelect, JdbcParameterBindings, ExecutionContext, RowTransformer, Class, StatementCreator, ResultsConsumer)} instead |
47 | | - */ |
48 | | - @Deprecated(forRemoval = true, since = "6.6") |
49 | | - default <T, R> T executeQuery( |
50 | | - JdbcOperationQuerySelect jdbcSelect, |
51 | | - JdbcParameterBindings jdbcParameterBindings, |
52 | | - ExecutionContext executionContext, |
53 | | - RowTransformer<R> rowTransformer, |
54 | | - Class<R> domainResultType, |
55 | | - Function<String, PreparedStatement> statementCreator, |
56 | | - ResultsConsumer<T, R> resultsConsumer) { |
57 | | - return executeQuery( |
58 | | - jdbcSelect, |
59 | | - jdbcParameterBindings, |
60 | | - executionContext, |
61 | | - rowTransformer, |
62 | | - domainResultType, |
63 | | - (executionContext1, sql) -> statementCreator.apply( sql ), |
64 | | - resultsConsumer |
65 | | - ); |
66 | | - } |
67 | | - |
68 | 44 | /** |
69 | 45 | * @since 6.6 |
70 | 46 | */ |
@@ -213,8 +189,9 @@ interface StatementCreator { |
213 | 189 | } |
214 | 190 |
|
215 | 191 | /* |
216 | | - When `Query#scroll()` is call the query is not executed immediately, a new ExecutionContext with the values of the `persistenceContext.isDefaultReadOnly()` and of the `queryOptions.isReadOnly()` |
217 | | - set at the moment of the Query#scroll() call is created in order to use it when the query will be executed. |
| 192 | + When `Query#scroll()` is call the query is not executed immediately, a new ExecutionContext with the values |
| 193 | + of the `persistenceContext.isDefaultReadOnly()` and of the `queryOptions.isReadOnly()` set at the moment of |
| 194 | + the Query#scroll() call is created in order to use it when the query will be executed. |
218 | 195 | */ |
219 | 196 | private ExecutionContext getScrollContext(ExecutionContext context) { |
220 | 197 | class ScrollableExecutionContext extends BaseExecutionContext implements QueryOptions { |
@@ -388,45 +365,25 @@ public Set<String> getDisabledFetchProfiles() { |
388 | 365 | } |
389 | 366 | } |
390 | 367 |
|
391 | | - final QueryOptions queryOptions = context.getQueryOptions(); |
392 | | - final Boolean readOnly; |
393 | | - if ( queryOptions.isReadOnly() == null ) { |
394 | | - readOnly = context.getSession().getPersistenceContext().isDefaultReadOnly(); |
395 | | - } |
396 | | - else { |
397 | | - readOnly = queryOptions.isReadOnly(); |
398 | | - } |
399 | | - final Integer timeout = queryOptions.getTimeout(); |
400 | | - final FlushMode flushMode = queryOptions.getFlushMode(); |
401 | | - final AppliedGraph appliedGraph = queryOptions.getAppliedGraph(); |
402 | | - final TupleTransformer<?> tupleTransformer = queryOptions.getTupleTransformer(); |
403 | | - final ResultListTransformer<?> resultListTransformer = queryOptions.getResultListTransformer(); |
404 | | - final Boolean resultCachingEnabled = queryOptions.isResultCachingEnabled(); |
405 | | - final CacheRetrieveMode cacheRetrieveMode = queryOptions.getCacheRetrieveMode(); |
406 | | - final CacheStoreMode cacheStoreMode = queryOptions.getCacheStoreMode(); |
407 | | - final String resultCacheRegionName = queryOptions.getResultCacheRegionName(); |
408 | | - final LockOptions lockOptions = queryOptions.getLockOptions(); |
409 | | - final String comment = queryOptions.getComment(); |
410 | | - final List<String> databaseHints = queryOptions.getDatabaseHints(); |
411 | | - final Integer fetchSize = queryOptions.getFetchSize(); |
412 | | - final Limit limit = queryOptions.getLimit(); |
413 | | - |
| 368 | + final QueryOptions options = context.getQueryOptions(); |
414 | 369 | return new ScrollableExecutionContext( |
415 | | - timeout, |
416 | | - flushMode, |
417 | | - readOnly, |
418 | | - appliedGraph, |
419 | | - tupleTransformer, |
420 | | - resultListTransformer, |
421 | | - resultCachingEnabled, |
422 | | - cacheRetrieveMode, |
423 | | - cacheStoreMode, |
424 | | - resultCacheRegionName, |
425 | | - lockOptions, |
426 | | - comment, |
427 | | - databaseHints, |
428 | | - fetchSize, |
429 | | - limit, |
| 370 | + options.getTimeout(), |
| 371 | + options.getFlushMode(), |
| 372 | + options.isReadOnly() == null |
| 373 | + ? context.getSession().getPersistenceContext().isDefaultReadOnly() |
| 374 | + : options.isReadOnly(), |
| 375 | + options.getAppliedGraph(), |
| 376 | + options.getTupleTransformer(), |
| 377 | + options.getResultListTransformer(), |
| 378 | + options.isResultCachingEnabled(), |
| 379 | + options.getCacheRetrieveMode(), |
| 380 | + options.getCacheStoreMode(), |
| 381 | + options.getResultCacheRegionName(), |
| 382 | + options.getLockOptions(), |
| 383 | + options.getComment(), |
| 384 | + options.getDatabaseHints(), |
| 385 | + options.getFetchSize(), |
| 386 | + options.getLimit(), |
430 | 387 | context |
431 | 388 | ); |
432 | 389 | } |
|
0 commit comments