Hi, using this method seems to cause dataloss in some situations. How can I make sure that all data is written back to the database before clearing the cache?
I run it after creating the schema like this:
SchemaExport s = new SchemaExport(HibernateSessionFactory.getMetadata()); s.execute(false, true, false, false);
In one execution path after the evict call the application is shutdown. So the only task in this case is to create the database. Unfortunately in this case sometimes all, sometimes only a few tables and sometimes none at all is created. Seems that the evict call does not write back the cache and what is missing is that I do it myself. Looks like the schemaexport generates sql commands that do not hit the database before the connection is closed and the application is shutdown.
I can add a flush to all the code but they are not needed while the application is running. Is there an api call to wait until everything is written to the database before calling evict? Best regards, Carsten
|