본문 바로가기 메뉴 바로가기

Development Diary

프로필사진
  • 글쓰기
  • 관리
  • 태그
  • 방명록
  • RSS

Development Diary

검색하기 폼
  • 분류 전체보기 (144)
    • Java (74)
      • Effective Java (72)
      • Algorithm (0)
    • Spring (44)
      • Spring MVC (5)
      • Spring Framework (10)
      • Spring Data (9)
      • Spring Batch (0)
      • Spring Security (9)
      • Spring HATEOAS (0)
      • Spring Setting (6)
      • Spring Cloud (3)
      • Spring Template (1)
    • AWS (1)
    • DB (2)
    • Paper (0)
    • CS (2)
    • Project (16)
    • 잡다구리 (5)
  • 방명록

간접 참조 연관 관계 삭제 (2)
  • 분류 전체보기 (144)
    • Java (74)
      • Effective Java (72)
      • Algorithm (0)
    • Spring (44)
      • Spring MVC (5)
      • Spring Framework (10)
      • Spring Data (9)
      • Spring Batch (0)
      • Spring Security (9)
      • Spring HATEOAS (0)
      • Spring Setting (6)
      • Spring Cloud (3)
      • Spring Template (1)
    • AWS (1)
    • DB (2)
    • Paper (0)
    • CS (2)
    • Project (16)
    • 잡다구리 (5)
[JPA] 간접 참조 연관 관계 EventListener로 삭제하기 - 2

이전 글에서 이어지는 내용으로 commitOrRollback의 세부 구현을 살펴보자 EventListener 구현체는 JpaEventListener를 구현하고 여기서는 공통 Transaction 작업만 처리해주면 된다 import java.util.function.Consumer; import org.hibernate.Session; import org.hibernate.Transaction; import org.hibernate.engine.spi.SharedSessionContractImplementor; public interface JpaEventListener { default void commitOrRollback( SharedSessionContractImplementor session, C..

Spring/Spring Data 2022. 10. 2. 01:39
[JPA] 간접 참조 연관 관계 EventListener로 삭제하기 - 1

도메인 주도 개발 혹은 MSA로 갈 때 연관 관계를 다루기 위해서는 객체 자체가 아닌 식별자를 저장하곤 한다 예시만 살짝 맛보기로 하기 위해 극단적으로 간단한 엔티티를 만들었다, Panda -> Bear에 대한 간접 참조를 갖는다 @Entity @NoArgsConstructor @Getter public class Panda { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long id; private String name; private Long bearId; @Builder public Panda(String name, Long bearId) { this.name = name; this.bearId = bearId; } } @Entity ..

Spring/Spring Data 2022. 10. 2. 00:28
이전 1 다음
이전 다음
링크
  • GitHub 🐼
글 보관함
«   2025/05   »
일 월 화 수 목 금 토
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Total
Today
Yesterday

Blog is powered by Tistory / Designed by Tistory

티스토리툴바