Skip to content
Ameen Abozaid
Planned lessonJNR-028-L04

Entity lifecycle

  • Lesson 4 of 8
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

name the four states and the moves between them.

Planned topics

  • Transient: new object, not known to JPA.
  • Managed: tracked by the persistence context; changes are saved at flush.
  • Detached: was managed, but the context closed (usually after the transaction).
  • Removed: marked for deletion at flush.
  • persist makes transient managed; merge copies a detached state into a managed instance; remove schedules deletion.
Draft outline details

Demonstration

a diagram: new → transient → persist → managed → remove → removed; managed → context closes → detached → merge → managed.

Check your understanding

Are changes to a detached entity saved automatically?

Show answer

No.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.