File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed
hibernate-reactive-core/src/main/java/org/hibernate/reactive/session Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change 13
13
import org .hibernate .LockOptions ;
14
14
import org .hibernate .UnknownProfileException ;
15
15
import org .hibernate .collection .spi .PersistentCollection ;
16
+ import org .hibernate .engine .spi .EntityEntry ;
16
17
import org .hibernate .engine .spi .PersistenceContext ;
17
18
import org .hibernate .engine .spi .SessionImplementor ;
18
19
import org .hibernate .event .internal .MergeContext ;
@@ -68,6 +69,8 @@ public interface ReactiveSession extends ReactiveQueryExecutor {
68
69
69
70
CompletionStage <Void > reactiveAutoflush ();
70
71
72
+ CompletionStage <Void > reactiveForceFlush (EntityEntry entry );
73
+
71
74
CompletionStage <Void > reactiveRefresh (Object entity , LockOptions lockMode );
72
75
73
76
CompletionStage <Void > reactiveRefresh (Object child , IdentitySet refreshedAlready );
Original file line number Diff line number Diff line change @@ -898,6 +898,26 @@ public CompletionStage<Void> reactiveAutoflush() {
898
898
return getHibernateFlushMode ().lessThan ( FlushMode .COMMIT ) ? voidFuture () : doFlush ();
899
899
}
900
900
901
+ @ Override
902
+ public CompletionStage <Void > reactiveForceFlush (EntityEntry entry ) {
903
+ if ( log .isDebugEnabled () ) {
904
+ log .debugf (
905
+ "Flushing to force deletion of re-saved object: %s" ,
906
+ MessageHelper .infoString ( entry .getPersister (), entry .getId (), getFactory () )
907
+ );
908
+ }
909
+
910
+ if ( getPersistenceContextInternal ().getCascadeLevel () > 0 ) {
911
+ return CompletionStages .failedFuture ( new ObjectDeletedException (
912
+ "deleted object would be re-saved by cascade (remove deleted object from associations)" ,
913
+ entry .getId (),
914
+ entry .getPersister ().getEntityName ()
915
+ ) );
916
+ }
917
+ checkOpenOrWaitingForAutoClose ();
918
+ return doFlush ();
919
+ }
920
+
901
921
private CompletionStage <Void > doFlush () {
902
922
checkTransactionNeededForUpdateOperation ( "no transaction is in progress" );
903
923
pulseTransactionCoordinator ();
You can’t perform that action at this time.
0 commit comments