To check if the given entity is managed by the current PersistenceContext you can use the EntityManager#contains(Object entity).
To check if the given entity is managed by the current PersistenceContext you can use the EntityManager#contains(Object entity).