분류 전체보기37 OneToOne Lazy Loading 막연하게 OneToOne 연관관계인 경우 Lazy Loading을 설정해도 Eager가 적용된다고 알고 있다가 외래 키의 주인은 Lazy Loading이 된다는 글을 보고 테스트해 봄 Lazy Loading 적용 전 @OneToOne @JoinColumn(name = "account_id") private Account account; 결과 Hibernate: select s1_0.id, s1_0.account_id, s1_0.address, s1_0.name, s1_0.tel from store s1_0 where s1_0.name like ? escape '\\' Hibernate: select a1_0.id, a1_0.address, a1_0.email, a1_0.password, a1_0.phon.. 2023. 11. 27. @Transactional Dive @Transactional에 대한 이해가 부족함을 느낌 $ 우선 Propagation REQUIRED(TransactionDefinition.PROPAGATION_REQUIRED) - Default Support a current transaction, create a new one if none exists Exception 발생시 부모/자식 모두 rollback SUPPORTS(TransactionDefinition.PROPAGATION_SUPPORTS) Support a current transaction, execute non-transactionally if none exists Transaction이 없어도 메서드는 정상 동작 MANDATORY(TransactionDefinition.PROPA.. 2023. 11. 24. Elasticsearch study 공부 시작하자마자 알게 된 건 AWS와의 오픈소스 윤리 관련 시비? 논쟁? AWS의 Open Search는 아직 스프링 공식문서에 안 보이니까 Elasticsearch로 공부하기로 함 결론부터 적어보면 이것은 NoSQL DB 형태의 검색 엔진인 것 같음 핵심 특징은 Index(RDB의 database)에 데이터를 저장할 때 역색인을 해서 저장함 Apache lucene library 기반으로 분산 노드를 지원, 노드 묶음을 클러스터라고 함 각 Index는 샤딩 방식을 적용하여 Primary shard와 Replica shard로 구성되며 다른 노드에 할담됨 Restful API를 이용하여 http body에 json 형식의 데이터를 담아 매핑 구조로 CRUD 수행함 사용하려면 apt/docker등 다운/.. 2023. 11. 24. 삽질 ep.3 (feat. Transactional) 주문 서비스 중에 주문을 완료하고 받은 포인트를 사장 계정에 넣는 API를 구현 @Transactional을 걸어놨으니 주문은 주문대로 계정은 계정대로 알아서 Dirty checking할 것이라고 생각했으나.. @Transactional public void completeOrders(Account owner, Long accountId) { List orders = orderRepository.findAllByAccountId(accountId); int totalPrice = 0; for (Order order : orders) { checkOrderStatus(order).complete(); totalPrice += order.getMenu().getPrice() * order.getQuantit.. 2023. 11. 22. 이전 1 2 3 4 5 6 ··· 10 다음