File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
hibernate-core/src/main/java/org/hibernate/query Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change @@ -181,16 +181,27 @@ protected void beforeQuery() {
181181
182182 session .prepareForQueryExecution ( requiresTxn ( options .getLockOptions ().getLockMode () ) );
183183 prepareForExecution ();
184+ prepareSessionFlushMode ( session );
185+ prepareSessionCacheMode ( session );
186+ }
184187
188+ /*
189+ * Used by Hibernate Reactive
190+ */
191+ protected void prepareSessionFlushMode (SharedSessionContractImplementor session ) {
185192 assert sessionFlushMode == null ;
186- assert sessionCacheMode == null ;
187-
188- final FlushMode effectiveFlushMode = getQueryOptions ().getFlushMode ();
193+ final var effectiveFlushMode = getQueryOptions ().getFlushMode ();
189194 if ( effectiveFlushMode != null && session instanceof SessionImplementor statefulSession ) {
190195 sessionFlushMode = statefulSession .getHibernateFlushMode ();
191196 statefulSession .setHibernateFlushMode ( effectiveFlushMode );
192197 }
198+ }
193199
200+ /*
201+ * Used by Hibernate Reactive
202+ */
203+ protected void prepareSessionCacheMode (SharedSessionContractImplementor session ) {
204+ assert sessionCacheMode == null ;
194205 final CacheMode effectiveCacheMode = getCacheMode ();
195206 if ( effectiveCacheMode != null ) {
196207 sessionCacheMode = session .getCacheMode ();
Original file line number Diff line number Diff line change @@ -568,6 +568,14 @@ public boolean hasCallbackActions() {
568568 return callback != null && callback .hasAfterLoadActions ();
569569 }
570570
571+ /*
572+ * Used by Hibernate Reactive
573+ */
574+ @ Override
575+ protected void resetCallback () {
576+ callback = null ;
577+ }
578+
571579 @ Override
572580 public QueryParameterBindings getQueryParameterBindings () {
573581 return parameterBindings ;
@@ -736,14 +744,17 @@ protected void prepareForExecution() {
736744 getSession ().flush ();
737745 }
738746 // Reset the callback before every execution
739- callback = null ;
747+ resetCallback () ;
740748 }
741749 // Otherwise, the application specified query spaces via the Hibernate
742750 // SynchronizeableQuery and so the query will already perform a partial
743751 // flush according to the defined query spaces - no need for a full flush.
744752 }
745753
746- private boolean shouldFlush () {
754+ /*
755+ * Used by Hibernate Reactive
756+ */
757+ protected boolean shouldFlush () {
747758 if ( getSession ().isTransactionInProgress () ) {
748759 final FlushMode flushMode = getQueryOptions ().getFlushMode ();
749760 return switch ( flushMode == null ? getSession ().getHibernateFlushMode () : flushMode ) {
You can’t perform that action at this time.
0 commit comments