diff --git a/framework/src/play/db/jpa/HibernateInterceptor.java b/framework/src/play/db/jpa/HibernateInterceptor.java index dcd71f007f..ae3c285968 100644 --- a/framework/src/play/db/jpa/HibernateInterceptor.java +++ b/framework/src/play/db/jpa/HibernateInterceptor.java @@ -13,7 +13,7 @@ public class HibernateInterceptor extends EmptyInterceptor { public HibernateInterceptor() { } - + @Override public int[] findDirty(Object o, Serializable id, Object[] arg2, Object[] arg3, String[] arg4, Type[] arg5) { if (o instanceof JPABase && !((JPABase) o).willBeSaved) { @@ -27,7 +27,7 @@ public boolean onCollectionUpdate(Object collection, Serializable key) throws Ca if (collection instanceof PersistentCollection) { Object o = ((PersistentCollection) collection).getOwner(); if (o instanceof JPABase) { - if (entities.get() != null) { + if (entities.get() instanceof JPABase) { return ((JPABase) o).willBeSaved || ((JPABase) entities.get()).willBeSaved; } else { return ((JPABase) o).willBeSaved; @@ -44,7 +44,7 @@ public boolean onCollectionRecreate(Object collection, Serializable key) throws if (collection instanceof PersistentCollection) { Object o = ((PersistentCollection) collection).getOwner(); if (o instanceof JPABase) { - if (entities.get() != null) { + if (entities.get() instanceof JPABase) { return ((JPABase) o).willBeSaved || ((JPABase) entities.get()).willBeSaved; } else { return ((JPABase) o).willBeSaved; @@ -62,7 +62,7 @@ public boolean onCollectionRemove(Object collection, Serializable key) throws Ca if (collection instanceof PersistentCollection) { Object o = ((PersistentCollection) collection).getOwner(); if (o instanceof JPABase) { - if (entities.get() != null) { + if (entities.get() instanceof JPABase) { return ((JPABase) o).willBeSaved || ((JPABase) entities.get()).willBeSaved; } else { return ((JPABase) o).willBeSaved;