The following conditions the Java object enters the persistence state:
- The Session.save () method transforms a temporary object into a persisted object.
- The objects obtained by the Session.load () and Session.get () methods are always in a persisted state.
- The Session.update (), Saveorupdate (), and Lock () methods transform the free object into a persistent state.
- The list () method returned by the query interface stores all persisted objects in the list collection.
- A persisted object is associated with a temporary object that, in the case of a cascade save, turns the temporary object into a persisted objectwhen it cleans up the cache .
Persisting object Features
- The OID is not NULL, or version is not NULL(hibernate mainly determines that the object is not persisted through these two properties);
- In the cache of session instances, it can be said that persisted objects are always associated with a session instance.
- When the session cleans up the cache, the database is updated synchronously, depending on the properties of the persisted object.
The Hibernate,session method causes the Java object to enter a persisted state; persisted object characteristics