이 콘텐츠는 선택한 언어로 제공되지 않습니다.
Chapter 3. Working with objects
3.1. Entity states 링크 복사링크가 클립보드에 복사되었습니다!
링크 복사링크가 클립보드에 복사되었습니다!
Like in Hibernate (comparable terms in parentheses), an entity instance is in one of the following states:
- New (transient): an entity is new if it has just been instantiated using the
new
operator, and it is not associated with a persistence context. It has no persistent representation in the database and no identifier value has been assigned. - Managed (persistent): a managed entity instance is an instance with a persistent identity that is currently associated with a persistence context.
- Detached: the entity instance is an instance with a persistent identity that is no longer associated with a persistence context, usually because the persistence context was closed or the instance was evicted from the context.
- Removed: a removed entity instance is an instance with a persistent identity, associated with a persistence context, but scheduled for removal from the database.
The
EntityManager
API allows you to change the state of an entity, or in other words, to load and store objects. You will find persistence with EJB3 easier to understand if you think about object state management, not managing of SQL statements.