본문 바로가기
Framework/Spring

Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException

by pcm9881 2023. 6. 12.

org.springframework.dao.InvalidDataAccessApiUsageException: Executing an update/delete query; nested exception is javax.persistence.TransactionRequiredException: Executing an update/delete query

 

@Transactional 추가해주시면 해결됩니다.

 

예시

import org.springframework.transaction.annotation.Transactional;

...

@Transactional
public void update(User user) {
    userRepository.save(user);
}
728x90

댓글