HHH-14811 Throw LazyInitializationException on lazy-loading an association on a deleted entity with bytecode enhancement
This commit is contained in:
parent
30a5acf741
commit
3810727f5d
|
@ -29,6 +29,7 @@ import org.hibernate.EntityMode;
|
|||
import org.hibernate.FetchMode;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.JDBCException;
|
||||
import org.hibernate.LazyInitializationException;
|
||||
import org.hibernate.LockMode;
|
||||
import org.hibernate.LockOptions;
|
||||
import org.hibernate.MappingException;
|
||||
|
@ -1149,8 +1150,9 @@ public abstract class AbstractEntityPersister
|
|||
// for the collection to the just loaded collection
|
||||
final EntityEntry ownerEntry = persistenceContext.getEntry( entity );
|
||||
if ( ownerEntry == null ) {
|
||||
// not good
|
||||
throw new AssertionFailure(
|
||||
// the entity is not in the session; it was probably deleted,
|
||||
// so we cannot load the collection anymore.
|
||||
throw new LazyInitializationException(
|
||||
"Could not locate EntityEntry for the collection owner in the PersistenceContext"
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue