I have two application First Application will persist into a database in a while loop , the loop will end after a long time (say 10-15 minutes). But The second application needs the data that the first application has already persisted in the database , The second application cannot wait for the first application to finish .It will start just after the first application has started running. I have used an EntityManager.flush() in the first application hoping that the first application will immediately synch the data with the database. So that the second application which is in a different transaction can start working with data .
This is not working , what is the purpose of flush() method than and how can i solve my problem ? Please help !!