inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

승윤님의 게시글

승윤 승윤

@seungyun93930553

수강평 작성수
-
평균평점
-

게시글 1

질문&답변

OSIV false 일때 영속성 관련해서 질문드립니다.

로그로 쿼리를 찍어봐도 save 호출하는 메소드는 select 밖에 안날라가고있더라구요.. 뭐를 놓치고있는건가요? import org . springframework . transaction . annotation . Transactional ; @ Service @ Transactional ( readOnly = true ) @ RequiredArgsConstructor public class service { ... @ Transactional public Entity insert ( String id ) { DTO dto = new DTO (); dto . setId ( id ); Entity entity = repository . save ( Entity . create ( dto )); log.debug("entity {}", entity); //여기서는 엔티티가 정상적으로 찍힙니다. return entity ; // 그렇다면 return이 되고난뒤에 트랜잭션이 종료되니 insert문이 나가야하는거 아닌가요?.. } } save말고 saveAndFlush를 사용하면.. no transaction is in progress 라고 오류가나오는데.. 왜.. @Transactional 안 메소드에서 이런에러가 생기는지..

좋아요수
0
댓글수
2
조회수
462