The JPA Entity Lifecycle

The four states an entity moves through, and the operations that move it.

  • 7 cards
  • 5 questions
  • About 7 min
  • Difficulty
Share

An entity loaded through JPA isn't just an object — it's an object in one of four states, and which state decides whether changing a field does anything at all. This topic is those four states, the operations that move an entity between them, and when each one's SQL actually reaches the database — which turns out to depend on how the entity's id is generated, not just on when you call flush().

Contents

7 cardsnot started