Spring JPA 리파지토리 트랜잭션성에 대해 1 개의 빠른 질문. 나는 트랜잭션으로 표시되고 봄 JPA 저장소 방법을Spring JPA 저장소 트랜잭션 성
userRegistrationRepository.deleteByEmail(email);
를 호출하지 않는 서비스를 그리고 그것은
@Repository
public interface UserRegistrationRepository extends JpaRepository<UserRegistration, Long> {
UserRegistration findByEmail(String email);
void deleteByEmail(String email);
}
로 정의 문제는 그것이 실제 거래와 없음의 EntityManager "로 실패하다 현재 스레드에서 사용 가능 - 'remove'호출을 안정적으로 처리 할 수 없으며 중첩 예외는 javax.persistence.TransactionRequiredException "예외입니다.
좋아, 서비스 또는deleteByEmail (..) 트랜잭션으로 방법을 표시하여 그것을 해결할 수 있지만, 지금은 충돌하는 이유는 이해할 수 없습니다. Spring 설명서에 명시 적으로 "저장소 인스턴스의 CRUD 메소드는 기본적으로 트랜잭션입니다."(http://docs.spring.io/spring-data/jpa/docs/current/reference/html/#transactions), 분명히이 것은 아닙니다 ...이 문장은 CrudRepository
의 멤버와 관련이 있습니까?
ps : 스프링 데이터 용 JPA 1.9.4