When I call:
entityManager.flush()
I get the exception mentioned in the title.
I am using Hibernate JPA.
I had this problem, just add @Transacctional annotation not only on the method, also in the class together with your @Service annotation.
for example:
@Service @Transactional public class MyService { }