Hey Sandeep,
Im a bit too lazy to find exactly where in the spec this is mentioned, but the statement in Mikalai's notes is correct. Check out the
API docs for the EntityManager.refresh() method where it also confirms the statement.
Throws:
IllegalStateException - if this EntityManager has been closed.
IllegalArgumentException - if not an entity or entity is not managed
TransactionRequiredException - if invoked on a container-managed entity manager of type PersistenceContextType.TRANSACTION and there is no transaction.
EntityNotFoundException - if the entity no longer exists in the database.
It can be managed if you add a merge() call in in the refresh() call e.g.