title: What is exact purpose of flush in JPA
body: <p>Some confusing explanation:
  flush(); Flushing is the process of synchronizing the underlying persistent store with persistable state held in memory.it will update or insert into your tables in the running transaction, but it may not commit those changes.</p>
  
  <p>If the changes are anyways going to be persisted in the database only after the commit then why to flush in the middle of the code. </p>
  
  <p>And after running the flush if any changes are made to the managed object then will that throw an Exception or will those get synchronized and then will get perisisted. If they get synchronized then again why flush in the first place. </p>