Controlling when SQL UPDATE is executing on ehcache 'd classes
- by thomers
We are using Hibernate and ehcache as 2nd level cache.
If I load an entity that is cached (e.g. cache-usage="read-write") and update it, it seems that this immediately results in an SQL UPDATE.
(How) Can I influence when this SQL UPDATE happens?
hibSession = HibernateUtil.getReadWriteSession();
tx = hibSession.beginTransaction();
User u = (User) hibSession.load(User.class, user_id);
u.modify();
hibSession.update(u);
tx.commit();
Edit: It seems that setting a CacheMode should have an effect, but each hibSession.update() results in an immediate SQL UPDATE, regardless which CacheMode I set.