[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


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());



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());



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