Learner
Learner

Reputation: 21393

Can an object state change from detached to transient

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?

Upvotes: 1

Views: 1351

Answers (1)

Wirus
Wirus

Reputation: 1190

No, it's not possible.

Transient object are objects with no reference in database. Persistent and detached on the other hand have representation in database (are persisted). Detached object is persisted, but for this object hibernate session is closed. You may move this object back to persistence state, but there is no way to change from detached to transient.

Upvotes: 1

Related Questions