From 29b8f6519cae0f55fd29e78e74ee9867f505339e Mon Sep 17 00:00:00 2001 From: Janario Oliveira Date: Sat, 5 Mar 2016 22:46:24 -0300 Subject: [PATCH] HHH-10593 - Avoid NullPointerException with auto_evict_collection_cache and many-to-many Added verification to many-to-many relation --- .../hibernate/cache/internal/CollectionCacheInvalidator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hibernate-core/src/main/java/org/hibernate/cache/internal/CollectionCacheInvalidator.java b/hibernate-core/src/main/java/org/hibernate/cache/internal/CollectionCacheInvalidator.java index 060f59545a..4e11b256a7 100644 --- a/hibernate-core/src/main/java/org/hibernate/cache/internal/CollectionCacheInvalidator.java +++ b/hibernate-core/src/main/java/org/hibernate/cache/internal/CollectionCacheInvalidator.java @@ -112,7 +112,8 @@ public class CollectionCacheInvalidator } // this is the property this OneToMany relation is mapped by String mappedBy = collectionPersister.getMappedByProperty(); - if ( mappedBy != null && !mappedBy.isEmpty() ) { + if ( !collectionPersister.isManyToMany() && + mappedBy != null && !mappedBy.isEmpty() ) { int i = persister.getEntityMetamodel().getPropertyIndex( mappedBy ); Serializable oldId = null; if ( oldState != null ) {