0

I use spring JPA and custom repository extends JpaRepository, for an very easy function:

@Transactional
void functionA(Book Book){
     repositoryA.deleteByBook(Book);
}

Then

javax.persistence.TransactionRequiredException

would be thrown, with exception message:

No transactional EntityManager available

Jens Schauder
  • 77,657
  • 34
  • 181
  • 348
vincent zhang
  • 444
  • 5
  • 20

1 Answers1

1

I get the answer now, it is strange:

Because the function should use "public"

vincent zhang
  • 444
  • 5
  • 20