I do not get any error messages as the entity manager is flushed when the transaction commits. In short here is my code
all within a single transaction:
I would have thought that when an Invoice is persisted the subsequent call to findExistingInvoice for the next charge would flush the entity manager as it does in my unit test.
I can work around this problem by changing my transaction boundaries, i.e. each iteration is separate unit of work but i would like to know what hibernate is doing.