-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HHH-16820 When batching enabled the LockModeType is ignored
- Loading branch information
Showing
5 changed files
with
80 additions
and
41 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...rnate-core/src/main/java/org/hibernate/loader/ast/internal/AbstractEntityBatchLoader.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html. | ||
*/ | ||
package org.hibernate.loader.ast.internal; | ||
|
||
import org.hibernate.Hibernate; | ||
import org.hibernate.LockOptions; | ||
import org.hibernate.engine.spi.SessionFactoryImplementor; | ||
import org.hibernate.engine.spi.SharedSessionContractImplementor; | ||
import org.hibernate.loader.ast.spi.EntityBatchLoader; | ||
import org.hibernate.metamodel.mapping.EntityMappingType; | ||
|
||
public abstract class AbstractEntityBatchLoader<T> | ||
extends SingleIdEntityLoaderSupport<T> | ||
implements EntityBatchLoader<T>{ | ||
|
||
protected final SingleIdEntityLoaderStandardImpl<T> singleIdLoader; | ||
|
||
public AbstractEntityBatchLoader(EntityMappingType entityDescriptor, SessionFactoryImplementor sessionFactory) { | ||
super( entityDescriptor, sessionFactory ); | ||
singleIdLoader = new SingleIdEntityLoaderStandardImpl<>( entityDescriptor, sessionFactory ); | ||
} | ||
|
||
@Override | ||
public T load( | ||
Object pkValue, | ||
Object entityInstance, | ||
LockOptions lockOptions, | ||
SharedSessionContractImplementor session) { | ||
final T entity = load( pkValue, entityInstance, lockOptions, null, session ); | ||
if ( Hibernate.isInitialized( entity ) ) { | ||
return entity; | ||
} | ||
else { | ||
return null; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters