Skip to content

Commit a8a1ebb

Browse files
committed
promote getSession() up to PersistentCollection
for the benefit of Hibernate Reactive, which currently casts to AbstractPersistentCollection
1 parent e255ae6 commit a8a1ebb

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

hibernate-core/src/main/java/org/hibernate/collection/spi/AbstractPersistentCollection.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,11 +897,7 @@ public void afterRowInsert(CollectionPersister persister, Object entry, int i) t
897897
@Override
898898
public abstract Collection<E> getOrphans(Serializable snapshot, String entityName) throws HibernateException;
899899

900-
/**
901-
* Get the session currently associated with this collection.
902-
*
903-
* @return The session
904-
*/
900+
@Override
905901
public final SharedSessionContractImplementor getSession() {
906902
return session;
907903
}

hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentArrayHolder.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ public boolean needsInserting(Object entry, int i, Type elemType) throws Hiberna
252252
public boolean needsUpdating(Object entry, int i, Type elemType) throws HibernateException {
253253
final Serializable sn = getSnapshot();
254254
return i < Array.getLength( sn )
255-
&& Array.get( sn, i ) != null
256-
&& Array.get( array, i ) != null
257-
&& elemType.isDirty( Array.get( array, i ), Array.get( sn, i ), getSession() );
255+
&& Array.get( sn, i ) != null
256+
&& Array.get( array, i ) != null
257+
&& elemType.isDirty( Array.get( array, i ), Array.get( sn, i ), getSession() );
258258
}
259259

260260
@Override

hibernate-core/src/main/java/org/hibernate/collection/spi/PersistentCollection.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.hibernate.HibernateException;
1313
import org.hibernate.Incubating;
14+
import org.hibernate.Internal;
1415
import org.hibernate.engine.spi.InstanceIdentity;
1516
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1617
import org.hibernate.metamodel.mapping.PluralAttributeMapping;
@@ -359,7 +360,6 @@ default boolean needsUpdating(
359360
*
360361
* @see #injectLoadedState
361362
*/
362-
@SuppressWarnings("UnusedReturnValue")
363363
boolean endRead();
364364

365365
/**
@@ -511,6 +511,13 @@ default boolean isDirectlyProvidedCollection(Object collection) {
511511

512512
void initializeEmptyCollection(CollectionPersister persister);
513513

514+
/**
515+
* Get the session currently associated with this collection.
516+
* Declared here for use by Hibernate Reactive.
517+
*/
518+
@Internal
519+
SharedSessionContractImplementor getSession();
520+
514521
/**
515522
* Is the collection newly instantiated?
516523
*

0 commit comments

Comments
 (0)