Skip to content

Commit

Permalink
HHH-16820 When batching enabled the LockModeType is ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
dreab8 committed Jun 27, 2023
1 parent bbbf8e9 commit bdcc619
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.hibernate.loader.ast.internal;

import org.hibernate.Hibernate;
import org.hibernate.LockMode;
import org.hibernate.LockOptions;
import org.hibernate.engine.spi.EntityKey;
import org.hibernate.engine.spi.SessionFactoryImplementor;
Expand Down Expand Up @@ -89,7 +90,8 @@ private T load(
LockOptions lockOptions,
Boolean readOnly,
SharedSessionContractImplementor session) {
if ( hasSingleId ) {
// We disable batching if lockMode != NONE
if ( hasSingleId || lockOptions.getLockMode() != LockMode.NONE ) {
return singleIdLoader.load( id, entityInstance, lockOptions, readOnly, session );
}

Expand Down

0 comments on commit bdcc619

Please sign in to comment.