I was working with a hibernate 3.6 project which use annotations for mapping and now I migrate it to hibernate 5.1 and i have this run time exception Non-entity object instance passed to evict Below is the call to evict
HibernateUtils.getSession().evict(origProject.getProbidinfo());
HibernateUtils.getSession().evict(origProject);
And below is the code from DefaultEvictEventListener.class from where the exception is throwing
EntityPersister persister = null;
final String entityName = persistenceContext.getSession().guessEntityName( object );
if ( entityName != null ) {
try {
persister = persistenceContext.getSession().getFactory().getEntityPersister( entityName );
}
catch (Exception ignore) {
}
}
if ( persister == null ) {
throw new IllegalArgumentException( "Non-entity object instance passed to evict : " + object );
}
where persister is null in my case in hibernate 5.1. I can provide further details, if its not clear