Skip to content

Commit 8f654f0

Browse files
committed
HHH-19384 Change the scope of more methods
For Hibernate Reactive. Related to hibernate/hibernate-reactive#2181
1 parent 0122a5a commit 8f654f0

File tree

2 files changed

+35
-3
lines changed

2 files changed

+35
-3
lines changed

hibernate-core/src/main/java/org/hibernate/internal/SessionImpl.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -2555,7 +2555,8 @@ private <T> T find(Class<T> entityClass, Object primaryKey, LockOptions lockOpti
25552555
}
25562556
}
25572557

2558-
private static <T> void logIgnoringEntityNotFound(Class<T> entityClass, Object primaryKey) {
2558+
// Hibernate Reactive calls this
2559+
protected static <T> void logIgnoringEntityNotFound(Class<T> entityClass, Object primaryKey) {
25592560
if ( log.isDebugEnabled() ) {
25602561
log.ignoringEntityNotFound(
25612562
entityClass != null ? entityClass.getName(): null,

hibernate-core/src/main/java/org/hibernate/loader/internal/IdentifierLoadAccessImpl.java

+33-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
*
3939
* @author Steve Ebersole
4040
*/
41+
// Hibernate Reactive extends this class: see ReactiveIdentifierLoadAccessImpl
4142
public class IdentifierLoadAccessImpl<T> implements IdentifierLoadAccess<T>, JavaType.CoercionContext {
4243
private final LoadAccessContext context;
4344
private final EntityPersister entityPersister;
@@ -85,6 +86,7 @@ public final T getReference(Object id) {
8586
return perform( () -> doGetReference( id ) );
8687
}
8788

89+
// Hibernate Reactive overrides this
8890
protected T perform(Supplier<T> executor) {
8991
final SessionImplementor session = context.getSession();
9092
final CacheMode sessionCacheMode = session.getCacheMode();
@@ -122,6 +124,7 @@ protected T perform(Supplier<T> executor) {
122124
}
123125

124126
@SuppressWarnings( "unchecked" )
127+
// Hibernate Reactive overrides this
125128
protected T doGetReference(Object id) {
126129
final SessionImplementor session = context.getSession();
127130
final EntityMappingType concreteType = entityPersister.resolveConcreteProxyTypeForId( id, session );
@@ -147,7 +150,8 @@ public Optional<T> loadOptional(Object id) {
147150
}
148151

149152
@SuppressWarnings( "unchecked" )
150-
protected final T doLoad(Object id) {
153+
// Hibernate Reactive overrides this
154+
protected T doLoad(Object id) {
151155
final SessionImplementor session = context.getSession();
152156
Object result;
153157
try {
@@ -162,7 +166,8 @@ protected final T doLoad(Object id) {
162166
return (T) result;
163167
}
164168

165-
private Object coerceId(Object id, SessionFactoryImplementor factory) {
169+
// Used by Hibernate Reactive
170+
protected Object coerceId(Object id, SessionFactoryImplementor factory) {
166171
if ( isLoadByIdComplianceEnabled( factory ) ) {
167172
return id;
168173
}
@@ -236,4 +241,30 @@ public IdentifierLoadAccess<T> disableFetchProfile(String profileName) {
236241
}
237242
return this;
238243
}
244+
245+
// Getters for Hibernate Reactive
246+
247+
protected CacheMode getCacheMode() {
248+
return cacheMode;
249+
}
250+
251+
protected GraphSemantic getGraphSemantic() {
252+
return graphSemantic;
253+
}
254+
255+
protected LoadAccessContext getContext() {
256+
return context;
257+
}
258+
259+
protected EntityPersister getEntityPersister() {
260+
return entityPersister;
261+
}
262+
263+
protected LockOptions getLockOptions() {
264+
return lockOptions;
265+
}
266+
267+
public RootGraphImplementor<T> getRootGraph() {
268+
return rootGraph;
269+
}
239270
}

0 commit comments

Comments
 (0)