-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: how to use sessionFactory.getCache().evictAllRegions();?
PostPosted: Tue Jul 21, 2015 4:53 am 
Newbie

Joined: Fri Jul 03, 2015 11:36 am
Posts: 1
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.