JPA

    [Spring boot] JPA dirty checking 시행 시점

    [Spring boot] JPA dirty checking 시행 시점

    직접 @Transactional 어노테이션이 달린 메소드를 실행해보며 언제 db에 저장되는지 확인해보자 PostApiController.java @PostMapping("api/v1/post/{id}") public PostResponseDto update(@PathVariable Long id, @RequestBody PostUpdateRequestDto requestDto){ System.out.println("transaction 시작"); PostResponseDto dto= postService.update(id, requestDto); System.out.println("transaction 종료"); return dto; } PostService.java @Transactional publi..

    [JPA/hibernate] Parameter value [\] did not match expected type [~] 오류 해결방법

    [JPA/hibernate] Parameter value [\] did not match expected type [~] 오류 해결방법

    JPA 프로젝트에서 findByItemContaining 등 sql에서의 like 구문 실행 시 같은 method를 두 번 실행하게 되면 오류가 발생하는 상황이 있다. https://github.com/spring-projects/spring-data-jpa/issues/2472 Issue with spring-data "startingWith" and hibernate 5.6.7: Parameter value [\] did not match expected type [java.lang.String (n/ Hello, I am trying to fetch some entity using a “find all by property starting with” query which amount to a Cri..

    JPA Auditing 이란?

    Audit : 감시, 감사하다. Spring Data provides sophisticated support to transparently keep track of who created or changed an entity and when the change happened. To benefit from that functionality, you have to equip your entity classes with auditing metadata that can be defined either using annotations or by implementing an interface. Spring Data JPA ships with an entity listener that can be used to tr..