Why is @Transactional needed for delete calls but not update or create?

Viewed 167

I have a vague understanding of Transactions in Java. I get the following error

javax.persistence.TransactionRequiredException: No EntityManager with actual transaction available for current thread - cannot reliably process 'remove' call

if I don't add @Transactional to my delete method in the controller. But @Transactional is not needed in my create or update methods in the controller.

Why? They are all writes into the DB, so they should all be transactional? What exactly does @Transactional do?

0 Answers
Related