<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Answers to: Ivy business data store rollback in case of problem (transaction management)</title><link>https://answers.axonivy.com/questions/3828/ivy-business-data-store-rollback-in-case-of-problem-transaction-management</link><description>&lt;p&gt;Hello IvyTeam,&lt;/p&gt;
&lt;p&gt;We are using the Ivy.repo() API for storing our data. 
Let's say we want to save a list of objects and if there is a problem by saving one of them, we should rollback what has been done for the previous ones.&lt;/p&gt;
&lt;p&gt;Is there a kind of transaction management with the Ivy.repo() API? Can we work like in one "transaction" for having the advantage of such a rollback function?&lt;/p&gt;
&lt;p&gt;Or should we implement it by our own, like going back to previous objects versions? Do you know how to achieve that?&lt;/p&gt;
&lt;p&gt;Thanks a lot in advance
Emmanuel&lt;/p&gt;</description><atom:link href="https://answers.axonivy.com/questions/3828/ivy-business-data-store-rollback-in-case-of-problem-transaction-management" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 28 May 2019 03:56:42 -0400</lastBuildDate><item><title>Answer by Reguel Wermelinger</title><link>https://answers.axonivy.com/questions/3828/ivy-business-data-store-rollback-in-case-of-problem-transaction-management/3829</link><description>&lt;p&gt;Hi there&lt;/p&gt;
&lt;p&gt;Business data uses an &lt;strong&gt;optimistic locking&lt;/strong&gt; approach: so it gives you many possibilities for save update/write/merge scenarios 
&lt;a href="https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.datamodeling.html#ivy-businessdata-concept"&gt;https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.datamodeling.html#ivy-businessdata-concept&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;This is why we can provide rock solid persistence mechanisms reflected by multitudes of write methods (save, update, overwrite): &lt;a href="https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/business/data/store/BusinessDataRepository.html"&gt;https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/business/data/store/BusinessDataRepository.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img alt="alt text" src="https://answers.axonivy.com/upfiles/businessDataRepo_update.png"&gt;&lt;/p&gt;
&lt;p&gt;So I guess you are looking for the update() method which provides the richest capabilities to react on persistence failures.&lt;/p&gt;
&lt;p&gt;If you have the rollback of non-atomar write operations in mind, then it is a very different case. To support this would be a paradigm break for optimistic locking. As optimistic locking is designed to get rid of all the problems of classical tx based write scenarios. &lt;/p&gt;
&lt;p&gt;So basically if you have list of objects that belongs together for being in a consistent state, it should also be shared in the same businessData object.
But maybe we clarify this better with a concrete data model. Feel free to share it :-)&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Reguel Wermelinger</dc:creator><pubDate>Tue, 28 May 2019 03:56:42 -0400</pubDate><guid>https://answers.axonivy.com/questions/3828/ivy-business-data-store-rollback-in-case-of-problem-transaction-management/3829</guid></item></channel></rss>