HHH-17442 Use FlushMode.MANUAL for select query in ValidityAuditStrategy

This commit is contained in:
Vincent Stradiot 2023-11-20 09:03:21 +01:00 committed by Christian Beikov
parent 2c86dcd5be
commit a3342ec233
1 changed files with 2 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import org.hibernate.FlushMode;
import org.hibernate.LockOptions;
import org.hibernate.Session;
import org.hibernate.engine.jdbc.spi.JdbcCoordinator;
@ -258,7 +259,7 @@ public class ValidityAuditStrategy implements AuditStrategy {
addEndRevisionNullRestriction( configuration, qb.getRootParameters() );
final List<Object> l = qb.toQuery( session ).setLockOptions( LockOptions.UPGRADE ).list();
final List<Object> l = qb.toQuery( session ).setHibernateFlushMode(FlushMode.MANUAL).setLockOptions( LockOptions.UPGRADE ).list();
// Update the last revision if one exists.
// HHH-5967: with collections, the same element can be added and removed multiple times. So even if it's an