일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- traceId
- spring
- Spring JPA
- HashMap
- spring MVC
- jpa
- asynccustomautoconfiguration
- @FunctionalInterface
- traceasynccustomautoconfiguration
- java list
- SpringMVC
- wire type
- EnableWebMvc
- Sleuth
- micrometer tracing
- grpc
- aws secretmanager
- Spring Boot
- java.util.list
- ResponseBody
- awssecretsmanagerpropertysources
- java lambda
- map
- elasticsearch
- DeferredImportSelector
- asyncconfigurer
- CompletableFuture
- kotlin
- java
- list
- Today
- Total
목록jpa (2)
du.study기록공간
JPA 를 사용하면서 save동작시, event를 등록하는 방법에 대해 기록하려합니다. 특정 entity가 저장이 될때, event호출을 통하여 특정 동작을 수행하게 할 수 있습니다. 코드로 간략하게 보면 다음과 같습니다. Event 코드 public class AccountEvent extends ApplicationEvent { private final Account account; public AccountEvent(Object source) { super(source); this.account = (Account) source; } public Account getAccount() { return account; } } Listener 코드 @Component public class Account..

JPA를 사용하다보면 가끔 Bulk 업데이트를 위하여, query를 사용하여 업데이트 하는 경우가 있습니다. 그리고 이 경우, 우리는 항상 @modifying를 사용하게 됩니다. 그렇다면 어째서 @modifying를 사용해야만 하는것을까라는 궁금증이 생겼습니다. 그래서 @Query를 이용해서 업데이트 쿼리를 작성하되 @modifying를 사용, 미사용 상태로 돌려본 후, 결과를 지켜봤습니다. 우선 Repository interface에 @Modifying을 선언하지 않고 실행한 결과입니다. @Component public class JpaRunner implements ApplicationRunner { @Autowired private Repo repo; @Transactional @Override p..