If there is a call to a service method proxied by Hibernate transaction manager in a situation as follows:
save Object A
store STATUS that save was sucessful
save Object B
transaction ends and flush occurs
When flush occurs A and B get written to database but the STATUS was already stored so if A now fails STATUS will be incorrect. What is the correct practice for having service method return the correct status of A's save?
Is a flush nessecary after saving A? Is there a way to in general force a flush after every save? What are the implications of this way?


Reply With Quote