Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
In Hibenate, for an object there can be 3 states -
transient, persistent, detached.
But can a object state change from detached to transient and how is that possible?
不,这是不可能的。
Transient对象是在数据库中没有引用的对象。 另一方面,在数据库中有表示(被持久化)Persistent。detached分离的对象是持久的,但是对于这个对象,休眠会话是关闭的。您可以将此对象移回持久状态,但无法从分离变为瞬态。
Transient
Persistent
detached