Skip to content

Commit 4303f09

Browse files
committed
Revert "[hibernate#1514] Catch errors thrown while executing a transactions"
This reverts commit 4a997c5.
1 parent ea2a93d commit 4303f09

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/impl/MutinySessionImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -508,8 +508,7 @@ Uni<T> execute(Function<Mutiny.Transaction, Uni<T>> work) {
508508
* roll back) and an error thrown by the work.
509509
*/
510510
Uni<T> executeInTransaction(Function<Mutiny.Transaction, Uni<T>> work) {
511-
return Uni.createFrom()
512-
.deferred( () -> work.apply( this ) )
511+
return work.apply( this )
513512
// only flush() if the work completed with no exception
514513
.call( this::flush ).call( this::beforeCompletion )
515514
// in the case of an exception or cancellation

hibernate-reactive-core/src/main/java/org/hibernate/reactive/mutiny/impl/MutinyStatelessSessionImpl.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ Uni<T> execute(Function<Mutiny.Transaction, Uni<T>> work) {
267267
* and an error thrown by the work.
268268
*/
269269
Uni<T> executeInTransaction(Function<Mutiny.Transaction, Uni<T>> work) {
270-
return Uni.createFrom().deferred( () -> work.apply( this ) )
270+
return work.apply( this )
271271
// in the case of an exception or cancellation
272272
// we need to rollback the transaction
273273
.onFailure().call( this::rollback )

hibernate-reactive-core/src/main/java/org/hibernate/reactive/stage/impl/StageSessionImpl.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646

4747
import static org.hibernate.reactive.util.impl.CompletionStages.applyToAll;
4848
import static org.hibernate.reactive.util.impl.CompletionStages.returnOrRethrow;
49-
import static org.hibernate.reactive.util.impl.CompletionStages.voidFuture;
5049

5150
/**
5251
* Implements the {@link Stage.Session} API. This delegating class is
@@ -435,7 +434,7 @@ CompletionStage<T> execute(Function<Stage.Transaction, CompletionStage<T>> work)
435434
* roll back) and an error thrown by the work.
436435
*/
437436
CompletionStage<T> executeInTransaction(Function<Stage.Transaction, CompletionStage<T>> work) {
438-
return voidFuture().thenCompose( v -> work.apply( this ) )
437+
return work.apply( this )
439438
// only flush() if the work completed with no exception
440439
.thenCompose( result -> flush().thenApply( v -> result ) )
441440
// have to capture the error here and pass it along,

hibernate-reactive-core/src/main/java/org/hibernate/reactive/stage/impl/StageStatelessSessionImpl.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import java.util.function.Function;
2727

2828
import static org.hibernate.reactive.util.impl.CompletionStages.returnOrRethrow;
29-
import static org.hibernate.reactive.util.impl.CompletionStages.voidFuture;
3029

3130
/**
3231
* Implements the {@link Stage.StatelessSession} API. This delegating
@@ -208,8 +207,7 @@ CompletionStage<T> execute(Function<Stage.Transaction, CompletionStage<T>> work)
208207
* and an error thrown by the work.
209208
*/
210209
CompletionStage<T> executeInTransaction(Function<Stage.Transaction, CompletionStage<T>> work) {
211-
return voidFuture()
212-
.thenCompose( v -> work.apply( this ) )
210+
return work.apply( this )
213211
// have to capture the error here and pass it along,
214212
// since we can't just return a CompletionStage that
215213
// rolls back the transaction from the handle() function

0 commit comments

Comments
 (0)