Trying to check whether an entity is attached to the persistent context fails for lazy loaded entities.
It gives an error like Object$$EnhancedByCGLib is not a persistent entity.
I haved worked around this with the following code :
protected void init( EntityManager em ) { this.em = em; if ( em instanceof InjectedEntityManager ) { InjectedEntityManager iem = (InjectedEntityManager) em; org.hibernate.Session session = iem.getHibernateSession(); if ( !session.contains( entity) ) { entity = em.find( DMCarBean.class, entity.getUOID() ); } } else { if ( !em.contains( entity ) ) { entity = em.find( DMCarBean.class, entity.getUOID() ); } } }
Fixed in CVS thanks