Skip to content

Commit 76d8461

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 1e7fecb commit 76d8461

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

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,8 @@ public Object loadFromSecondLevelCache(
11021102
* Helper to avoid creating many new instances of {@link PostLoadEvent}.
11031103
* It's an allocation hot spot.
11041104
*/
1105-
private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
1105+
// Hibernate Reactive may need to use this
1106+
protected PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Object entity) {
11061107
final PostLoadEvent event = postLoadEvent;
11071108
if ( event == null ) {
11081109
return new PostLoadEvent( id, persister, entity, this );
@@ -1120,7 +1121,8 @@ private PostLoadEvent makePostLoadEvent(EntityPersister persister, Object id, Ob
11201121
* Helper to avoid creating many new instances of {@link LoadEvent}.
11211122
* It's an allocation hot spot.
11221123
*/
1123-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
1124+
// Hibernate Reactive may need to use this
1125+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, LockOptions lockOptions) {
11241126
final LoadEvent event = loadEvent;
11251127
if ( event == null ) {
11261128
return new LoadEvent( id, entityName, lockOptions, this, readOnly );
@@ -1141,7 +1143,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11411143
* Helper to avoid creating many new instances of {@link LoadEvent}.
11421144
* It's an allocation hot spot.
11431145
*/
1144-
private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
1146+
// Hibernate Reactive may need to use this
1147+
protected LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly, boolean isAssociationFetch) {
11451148
final LoadEvent event = loadEvent;
11461149
if ( event == null ) {
11471150
return new LoadEvent( id, entityName, isAssociationFetch, this, readOnly );
@@ -1158,7 +1161,8 @@ private LoadEvent makeLoadEvent(String entityName, Object id, Boolean readOnly,
11581161
}
11591162
}
11601163

1161-
private void releasePostLoadEvent(PostLoadEvent event) {
1164+
// Hibernate Reactive may need to use this
1165+
protected void releasePostLoadEvent(PostLoadEvent event) {
11621166
if ( postLoadEvent == null ) {
11631167
event.setEntity( null );
11641168
event.setId( null );
@@ -1167,7 +1171,8 @@ private void releasePostLoadEvent(PostLoadEvent event) {
11671171
}
11681172
}
11691173

1170-
private void releaseLoadEvent(LoadEvent event) {
1174+
// Hibernate Reactive may need to use this
1175+
protected void releaseLoadEvent(LoadEvent event) {
11711176
if ( loadEvent == null ) {
11721177
event.setEntityClassName( null );
11731178
event.setEntityId( null );
@@ -2559,7 +2564,8 @@ public <T> T find(EntityGraph<T> entityGraph, Object primaryKey, FindOption... o
25592564
return loadAccess.withLoadGraph( graph ).load( primaryKey );
25602565
}
25612566

2562-
private void checkTransactionNeededForLock(LockMode lockMode) {
2567+
// Hibernate Reactive may need to use this
2568+
protected void checkTransactionNeededForLock(LockMode lockMode) {
25632569
// OPTIMISTIC and OPTIMISTIC_FORCE_INCREMENT require a transaction
25642570
// because they involve a version check at the end of the transaction
25652571
// All flavors of PESSIMISTIC lock also clearly require a transaction
@@ -2568,7 +2574,8 @@ private void checkTransactionNeededForLock(LockMode lockMode) {
25682574
}
25692575
}
25702576

2571-
private static Boolean readOnlyHint(Map<String, Object> properties) {
2577+
// Hibernate Reactive may need to use this
2578+
protected static Boolean readOnlyHint(Map<String, Object> properties) {
25722579
if ( properties == null ) {
25732580
return null;
25742581
}
@@ -3056,7 +3063,8 @@ private void readObject(ObjectInputStream ois) throws IOException, ClassNotFound
30563063
eventListenerGroups = getFactory().getEventListenerGroups();
30573064
}
30583065

3059-
private Boolean getReadOnlyFromLoadQueryInfluencers() {
3066+
// Used by Hibernate reactive
3067+
protected Boolean getReadOnlyFromLoadQueryInfluencers() {
30603068
return loadQueryInfluencers != null ? loadQueryInfluencers.getReadOnly() : null;
30613069
}
30623070
}

0 commit comments

Comments
 (0)