File tree Expand file tree Collapse file tree 2 files changed +27
-4
lines changed
hibernate-core/src/main/java/org/hibernate/query Expand file tree Collapse file tree 2 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -180,16 +180,28 @@ protected void beforeQuery() {
180180
181181 session .prepareForQueryExecution ( requiresTxn ( options .getLockOptions ().getLockMode () ) );
182182 prepareForExecution ();
183+ prepareSessionFlushMode ( session );
184+ prepareSessionCacheMode ( session );
185+ }
183186
184- assert sessionFlushMode == null ;
185- assert sessionCacheMode == null ;
186187
188+ /*
189+ * Used by Hibernate Reactive
190+ */
191+ protected void prepareSessionFlushMode (SharedSessionContractImplementor session ) {
192+ assert sessionFlushMode == null ;
187193 final var effectiveFlushMode = getQueryOptions ().getFlushMode ();
188194 if ( effectiveFlushMode != null && session instanceof SessionImplementor statefulSession ) {
189195 sessionFlushMode = statefulSession .getHibernateFlushMode ();
190196 statefulSession .setHibernateFlushMode ( effectiveFlushMode );
191197 }
198+ }
192199
200+ /*
201+ * Used by Hibernate Reactive
202+ */
203+ protected void prepareSessionCacheMode (SharedSessionContractImplementor session ) {
204+ assert sessionCacheMode == null ;
193205 final var effectiveCacheMode = getCacheMode ();
194206 if ( effectiveCacheMode != null ) {
195207 sessionCacheMode = session .getCacheMode ();
Original file line number Diff line number Diff line change @@ -554,6 +554,14 @@ public boolean hasCallbackActions() {
554554 return callback != null && callback .hasAfterLoadActions ();
555555 }
556556
557+ /*
558+ * Used by Hibernate Reactive
559+ */
560+ @ Override
561+ protected void resetCallback () {
562+ callback = null ;
563+ }
564+
557565 @ Override
558566 public QueryParameterBindings getQueryParameterBindings () {
559567 return parameterBindings ;
@@ -722,14 +730,17 @@ protected void prepareForExecution() {
722730 getSession ().flush ();
723731 }
724732 // Reset the callback before every execution
725- callback = null ;
733+ resetCallback () ;
726734 }
727735 // Otherwise, the application specified query spaces via the Hibernate
728736 // SynchronizeableQuery and so the query will already perform a partial
729737 // flush according to the defined query spaces - no need for a full flush.
730738 }
731739
732- private boolean shouldFlush () {
740+ /*
741+ * Used by Hibernate Reactive
742+ */
743+ protected boolean shouldFlush () {
733744 if ( getSession ().isTransactionInProgress () ) {
734745 final var flushMode = getQueryOptions ().getFlushMode ();
735746 return switch ( flushMode == null ? getSession ().getHibernateFlushMode () : flushMode ) {
You can’t perform that action at this time.
0 commit comments