HomeAboutMeBlogGuest
© 2025 Sejin Cha. All rights reserved.
Built with Next.js, deployed on Vercel
🤩
개발
/
Spring Data
Spring Data
/
🧣
JPA(Java Persistence API)
/
🎽
Relation
🎽

Relation

  • RDB(RelationalDataBase) : Relation 과 해당 Relation의 join 을 통해 집합, 관계 연산을 할 수 있음
  • JPA는 기본적으로 쿼리를 최적화해서 만들어주기 때문에 만들어지는 쿼리가 Relation의 옵션에 따라 어떻게 바뀌게 되는지 잘 확인하면서 사용해야 함
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.MappingException: Could not determine type for: com.uplus.virtualoffice.domain.account.model.Department, at table: departments, for columns: [org.hibernate.mapping.Column(parent)]
위와 같은 에러 발생할 때가 연관관계 설정이 잘 안된 상태임
 
🔭
연관관계매핑 핵심 키워드
⛳
단방향, 양방향 연관관계 사용(등록, 수정, 삭제, 조회)
👖
Relation 종류(@OneToOne, @OneToMany ..)
🎭
Cascade
🔥
상속관계매핑, 식별자 클래스(pk여러개)
🥍
프록시와 연관관계 (LazyFetch , EagerFetch)