An entity bean instance can exist is one of the three states.
Transient : When an object is never persisted or associated with any session, it’s in transient state. Transient instances may be made persistent by calling save()
, persist()
or saveOrUpdate()
. Persistent instances may be made transient by calling delete()
.
Persistent : When an object is associated with a unique session, it’s in persistent state. Any instance returned by a get()
or load()
method is persistent.
Detached : When an object is previously persistent but not associated with any session, it’s in detached state. Detached instances may be made persistent by calling update()
, saveOrUpdate()
, lock()
or replicate()
. The state of a transient or detached instance may also be made persistent as a new persistent instance by calling merge()
.