Open dongwooklee96 opened 3 years ago
em.flush
직접 호출하는 방법@Getter
@Setter
@Entity
@AllArgsConstructor
@NoArgsConstructor
public class Member {
@Id
private Long id;
@Column(unique = true, length = 10)
private String name;
private Long age;
}
영속성 컨텍스트
EntityManager.psersist(entity)
엔티티의 생명 주기
비영속(new/transient) 영속성 컨텍스트와 전혀 관계가 없는 새로운 상태
영속(managed) 영속성 컨텍스트에 관리되는 상태 -> 영속 상태가 된다고 하더라도, 바로 쿼리가 날라가는 것이 아니다! -> 트랜잭션이 커밋되는 시점에 쿼리가 날라간다.
준영속(detached) 영속성 컨텍스트에 저장되었다가 분리된 상태
삭제(removed) 삭제된 상태
영속성 컨텍스트의 이점