I wanted to ask, if the annotation @Transactional of JPA can cause an race condition.
Following scenario:
- Program A is a java application which has an method with @Transactional annotation -> this method updates a column of a line X in the database
- Program B writes after the update of Program A a change into line X
- Program A's transactional method throws an exception and starts the rollback
What happens while these rollback? Is line X in the state which it has before program A started its method? Or does the @Transactional method log the table while access so no concurrent write access can happen? I think the update must happen while the transactional method, because I read the count of updated rows while that method and I throw an exception if that count isn't exact 1. I think this triggers the UPDATE operation. So some real rollback must happen (?) I read some information about @Transactional but I have not enough information about the whole JPA context to understand it ...
Maybe somebody could help me with my question.
Thanks ;)