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
  • 70,783
  • 26
  • 162
  • 317
vincent zhang
  • 434
  • 5
  • 18

1 Answers1

1

I get the answer now, it is strange:

Because the function should use "public"

vincent zhang
  • 434
  • 5
  • 18