-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#1932] Support ReactiveSelectionQuery#getResultCount for HQL
I need some changes in ORM before I can support it for native queries.
- Loading branch information
Showing
15 changed files
with
218 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...re/src/main/java/org/hibernate/reactive/sql/results/spi/ReactiveSingleResultConsumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* Copyright: Red Hat Inc. and Hibernate Authors | ||
*/ | ||
package org.hibernate.reactive.sql.results.spi; | ||
|
||
import java.util.concurrent.CompletionStage; | ||
|
||
import org.hibernate.Incubating; | ||
import org.hibernate.engine.spi.SharedSessionContractImplementor; | ||
import org.hibernate.reactive.sql.exec.spi.ReactiveRowProcessingState; | ||
import org.hibernate.reactive.sql.exec.spi.ReactiveValuesResultSet; | ||
import org.hibernate.sql.results.jdbc.internal.JdbcValuesSourceProcessingStateStandardImpl; | ||
import org.hibernate.sql.results.jdbc.spi.JdbcValuesSourceProcessingOptions; | ||
|
||
@Incubating | ||
public class ReactiveSingleResultConsumer<T> implements ReactiveResultsConsumer<T, T> { | ||
|
||
@Override | ||
public CompletionStage<T> consume( | ||
ReactiveValuesResultSet jdbcValues, | ||
SharedSessionContractImplementor session, | ||
JdbcValuesSourceProcessingOptions processingOptions, | ||
JdbcValuesSourceProcessingStateStandardImpl jdbcValuesSourceProcessingState, | ||
ReactiveRowProcessingState rowProcessingState, | ||
ReactiveRowReader<T> rowReader) { | ||
rowReader.getReactiveInitializersList().startLoading( rowProcessingState ); | ||
return rowProcessingState.next() | ||
.thenCompose( hasNext -> rowReader | ||
.reactiveReadRow( rowProcessingState, processingOptions ) | ||
.thenApply( result -> { | ||
rowProcessingState.finishRowProcessing( true ); | ||
rowReader.finishUp( jdbcValuesSourceProcessingState ); | ||
jdbcValuesSourceProcessingState.finishUp( false ); | ||
return result; | ||
} ) | ||
); | ||
} | ||
|
||
@Override | ||
public boolean canResultsBeCached() { | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.