I have a method that does a bunch of things; amongst them doing a number of inserts and updates.
It's declared thusly:
@Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.DEFAULT, readOnly = false)
public int saveAll() {
//do stuff;
}
It works exactly as it is supposed to and I have no problems with it. There are situations however when I want to force the rollback in spite of there not being an exception... at the moment, I'm forcing an exception when I encounter the right conditions, but it's ugly and I don't like it.
Can I actively call the rollback somehow?
The exception calls it... I'm thinking maybe I can too.
See Question&Answers more detail:os