I use spring boot with jpa.
@Transaction
public void processXXX(Billing billing){
Party party = getOldParty(billing);
delete(party);
createNewParty(billing);
}
@Transaction
public void delete(Party party){
repository.delete(party);
}
@Transaction
public void createNewParty(Billing billing){
...
repository.save(billing);
}
is there a way to be sure delete operation are done before createNewParty is running?
Yes, do a flush
between delete
and save