220.127.116.11. Entity States
An instance which has just been created in memory:
Car car = new Car().
A new instance may be passed to
EntityManager.persist()to be stored to the database, in which case it changes its state to Managed.
An instance loaded from the database, or a new one passed to
EntityManager.persist(). Belongs to a
EntityManagerinstance, i.e. is contained in its persistence context.
Any changes of the instance in Managed state will be saved to the database when the transaction that the
EntityManagerbelongs to is committed.
An instance loaded from the database and detached from its persistence context (as a result of the transaction end or serialization).
The changes applied to a Detached instance will be saved to the database only if this instance becomes Managed by being passed to