JPA

No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call

기기디 2021. 7. 5. 16:49

jpa사용중 만날수 있는 메시지로 소스상 ide에서 빨갛게 error 띄워주지 않아도 실행시켜보면 나는 오류다.

 

@Transactional을 선언해주지 않아 생기는 오류로 jpa는 기본적으로 transactional설정이 되어있어야한다.

 

api service나 메소드에 @Transactional 어노테이션을 설정해주자