Commit Transaction

Hi there, In our system, there is an entity with Attributes IDNumber, Status, Description and then about 200 other attributes. We have a microflow exposed as a web service that takes these parameters, creates an instance of the entity and then goes through a lengthy (up to three minutes) process to validate all the data. If a second call is made to the web service, lets say after a minute, with the same ID Number, it should retrieve the first instance and update that one rather than creating a new one. This is not happening, I assume because the first transaction has not been committed yet. What I've done now is to create a java action that just does the following call : this.getContext().endTransaction(); In the microflow, after updating the entity with all the details, I call this java action. My question is : will this work? Could this cause any unexpected behavior, because we commit in the middle of a microflow? What is the purpose of the Commit radio button on the Change event, if a change is not committed to the database?
2 answers

It's not recommended to end the transaction that the microflow started, everything you do afterwards in that microflow won't take place in a transaction anymore. See for a possible approach to your problem.


@Bas : That's the problem, I can't afford "unpredictable behavior". How will I get around this issue? What would happen if I : IContext newC = currentContext.getSession().getContext(); newC.startTransaction(); Update IDNUmber newC.endTransaction(); and then continue with the MF. Will the second process retrieve the first Entity?