[odb-users] ODB custom session notifications on transaction rollback

Konstantin Tarovik konstantin.tarovik at ab-soft.net
Tue Nov 24 19:24:18 EST 2015


Hello,

I have an issue while using transactions in conjunction with custom 
session notifications. Please look at the following three lines:

         odb::transaction t(_db->begin());

         _db->persist(c);

         t.commit();

During persist call (even before commit is called) I get the 
notification inside custom session telling that the element has been 
stored to the DB cache (actually I receive two callbacks in a row 
_cache_persist and _cache_insert). This is not perfect behavior IMO but 
it's ok. The real issue arises when I rollback the transaction:

         odb::transaction t(_db->begin());

         _db->persist(c);

         t.rollback();

I still receive the notification inside persist call telling that the 
element has been added. But when I rollback the transaction _cache_erase 
notification is not being called. Taking into account that I use 
notifications to make data consistent between the DB and UI this 
behavior causes data inconsistency.

Am I missing something?

Thank you.

--
Best regards,
Konstantin Tarovik



More information about the odb-users mailing list