Reputation: 6036
I have already looked through a number of topics about entityManager.flush() method. In my practice I always have used persist() and commit() methods.
Also I have found that sometimes flush() automatically executes during select request to database and at this point it checks for example constraints of database so if persisted objects is wrong due to constraints during select an exception will be thrown.
Actually I would like to understand:
When you do flush() method then does a persisted data become saved in database? So you don't need to do commit() after flush()?
What is the advantages of using flush() instead of commit(), may be in some concrete cases?
Upvotes: 4
Views: 9066
Reputation: 6036
Thanks to JB Nizet now there is some clearity about flush().
Here is some points:
Upvotes: 7