Ensuring atomicity of action

  
I am writing an espace which has some oprations regarding data manipulation of the data in the database, inserts, updates, etc. In particular in some operations, I have to do some trigger-like logic like incrementing a value from a record on a table when a given insert is made. Is there an outsystems mechanism to ensure the atomicity of the set of operations: insert + incrementing the value (update). I want all done, or nothing, this of course to guarantee database consistency. 

Thanks in Advance,

JoaoPinto
Hi,

I am not sure if the path you already followed, but how about this:

- entities are public yes
- expose-read-only als yes.
This way only the espace that holds the entity is allowed to create/update/delete them.

Next up, creating a wrapper around those actions where you do your logic.
create, increase counter, some logging.
the normal transaction-logic will be working, so when something goes wrong the transaction is being rolled back.


Thanks for your reply. Regardin the design of the modules, what I have is exactly that, a single module responsible for writing or deleting data. What I want to know is if Outsystems ensures that two operations in an action (for example: a create and an update ) are bound in order for both to be executed or none of them (atomicity). I know the DBMS ensures rollback, but as I am doing my logic in outsystems, do I have guarantees of atomicity?

Thanks
Joao,

As long as the changes are withing a transaction, they are atomic. Note that if you want to retrieve data, use the GetXXXForUpdate actions, as they will lock the records.
Kilian,  by transaction you mean action? 

Thanks
I meant database transaction. But to be honest I've never understood exactly when the Platform starts and finishes a transaction (i.e. when it issues the begin transaction / commit). But I am sure that there's no implicit commit within an action.