Use of Core.commit in java action

2
Is it advisable to commit an object inside a java action? Because as far as I am concerned this cannot be tracked. I myself have stumbled across changes being made to an object even though I could not find any evidence of a commit inside the mendix modeler. Then I remembered that one of the java actions commits an object.
asked
4 answers
3

No, this is not advisable, for the reasons you just outlined :)

One of the big advantages of mendix (ie the modeler) is that because everything is written in the mendix DSL, everything can be checked, and easily found later on. The case you described in your question is exactly what I'm referring to, committing the object in a java action creates weird voodoo behavior which can't be traced afterwards.

It also makes it harder for other people who might have to maintain your app later to understand what's happening.

answered
1

I do it frequently, but the changedDate is not recorded indeed. Events are committed however, so you could use your own changedDate (which is in most cases a better solution IMHO, since it allows you to control when the timestamp is updated and when not (on importing for example))

answered
1

Sure you can commit objects in a java action but like you said, it's more convenient to keep your logic in the modeler as much as possible as it's easier to keep track of where objects are changed, committed, etc.

answered
0

how can i commit a list in java action?

answered