Skip to content

Commit 30c9567

Browse files
committed
HHH-19348 Change scope of private methods in SessionImpl
Change scopes of some private methods to avoid duplication in Hibernate Reactive. Related to hibernate/hibernate-reactive#2181
1 parent 5c46a9f commit 30c9567

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

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

+16-8
Original file line numberDiff line numberDiff line change
@@ -1141,7 +1141,8 @@ public Object loadFromSecondLevelCache(
11411141
* Helper to avoid creating many new instances of {@link PostLoadEvent}.
11421142
* It's an allocation hot spot.
11431143
*/
1144-
private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
1144+
// Hibernate Reactive may need to use this
1145+
protected PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
11451146
final PostLoadEvent event = postLoadEvent;
11461147
if ( event == null ) {
11471148
return new PostLoadEvent( id, persister, entity, this );
@@ -1159,7 +1160,8 @@ private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Ob
11591160
* Helper to avoid creating many new instances of {@link LoadEvent}.
11601161
* It's an allocation hot spot.
11611162
*/
1162-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
1163+
// Hibernate Reactive may need to use this
1164+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
11631165
final LoadEvent event = loadEvent;
11641166
if ( event == null ) {
11651167
return new LoadEvent( id, entityName, lockOptions, this, readOnly );
@@ -1180,7 +1182,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11801182
* Helper to avoid creating many new instances of {@link LoadEvent}.
11811183
* It's an allocation hot spot.
11821184
*/
1183-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
1185+
// Hibernate Reactive may need to use this
1186+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
11841187
final LoadEvent event = loadEvent;
11851188
if ( event == null ) {
11861189
return new LoadEvent( id, entityName, isAssociationFetch, this, readOnly );
@@ -1197,7 +1200,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11971200
}
11981201
}
11991202

1200-
private void releasePostLoadEvent(PostLoadEvent event) {
1203+
// Hibernate Reactive may need to use this
1204+
protected void releasePostLoadEvent(PostLoadEvent event) {
12011205
if ( postLoadEvent == null ) {
12021206
event.setEntity( null );
12031207
event.setId( null );
@@ -1206,7 +1210,8 @@ private void releasePostLoadEvent(PostLoadEvent event) {
12061210
}
12071211
}
12081212

1209-
private void releaseLoadEvent(LoadEvent event) {
1213+
// Hibernate Reactive may need to use this
1214+
protected void releaseLoadEvent(LoadEvent event) {
12101215
if ( loadEvent == null ) {
12111216
event.setEntityClassName( null );
12121217
event.setEntityId( null );
@@ -2619,7 +2624,8 @@ public <T> T find(EntityGraph<T> entityGraph, Object primaryKey, FindOption... o
26192624
return loadAccess.withLoadGraph( graph ).load( primaryKey );
26202625
}
26212626

2622-
private void checkTransactionNeededForLock(LockMode lockMode) {
2627+
// Hibernate Reactive may need to use this
2628+
protected void checkTransactionNeededForLock(LockMode lockMode) {
26232629
// OPTIMISTIC and OPTIMISTIC_FORCE_INCREMENT require a transaction
26242630
// because they involve a version check at the end of the transaction
26252631
// All flavors of PESSIMISTIC lock also clearly require a transaction
@@ -2628,7 +2634,8 @@ private void checkTransactionNeededForLock(LockMode lockMode) {
26282634
}
26292635
}
26302636

2631-
private static Boolean readOnlyHint(Map<String, Object> properties) {
2637+
// Hibernate Reactive may need to use this
2638+
protected static Boolean readOnlyHint(Map<String, Object> properties) {
26322639
if ( properties == null ) {
26332640
return null;
26342641
}
@@ -3116,7 +3123,8 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
31163123
eventListenerGroups = getFactory().getEventListenerGroups();
31173124
}
31183125

3119-
private Boolean getReadOnlyFromLoadQueryInfluencers() {
3126+
// Used by Hibernate reactive
3127+
protected Boolean getReadOnlyFromLoadQueryInfluencers() {
31203128
return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null;
31213129
}
31223130
}

0 commit comments

Comments
 (0)