Hello IvyTeam,

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.

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?

Or should we implement it by our own, like going back to previous objects versions? Do you know how to achieve that?

Thanks a lot in advance Emmanuel

asked 28.05.2019 at 03:40

Emmanuel%20Comba's gravatar image

Emmanuel Comba
(suspended)
accept rate: 50%


Hi there

Business data uses an optimistic locking approach: so it gives you many possibilities for save update/write/merge scenarios https://developer.axonivy.com/doc/latest/DesignerGuideHtml/ivy.datamodeling.html#ivy-businessdata-concept

This is why we can provide rock solid persistence mechanisms reflected by multitudes of write methods (save, update, overwrite): https://developer.axonivy.com/doc/latest/PublicAPI/ch/ivyteam/ivy/business/data/store/BusinessDataRepository.html

alt text

So I guess you are looking for the update() method which provides the richest capabilities to react on persistence failures.

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.

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 :-)

link

answered 28.05.2019 at 03:56

Reguel%20Wermelinger's gravatar image

Reguel Werme... ♦♦
9.4k31958
accept rate: 70%

edited 28.05.2019 at 04:00

Thanks for your answer Reguel. We are exactly is this scenario: non-atomar write operations in mind. Here we would like to have the save operation of several different objects in one transaction: if one fails all the previous ones should be rolled-back automatically. This is something the application will have to take care from itself.

(28.05.2019 at 04:55) Emmanuel Comba Emmanuel%20Comba's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×147
×17
×1
×1

Asked: 28.05.2019 at 03:40

Seen: 1,631 times

Last updated: 28.05.2019 at 04:55