The rollback works as designed because a rollback is only reverting database commits and is not touching the in-memory attribute-value of NewTestObect. My tests result in these conclusions:
The Rollback is rolling back all database-actions since the last start transaction. Look at the objects ending up in the database, they all have Name ‘test_name’. So: ok.
Removing the Rollback-action, restarting the app, makes the objects in the database get the name ‘test_name_CHANGED’. So far so good.
The only thing that this rollback-action does not do, is reverting the in-memory attribute-value of NewTestObect, That still is ‘test_name_CHANGED’ . That is the source of your confusion.
If you use mendix own rollback action it works. In addition to Tim's answer, mendix rollback function works for objects not yet committed.
If you want to revert a committed object, you could probably use the rollback java action, followed by a database retrieve.
Thank you Tim van Steenbergen and Ramón Frigge for answering my questions so quickly.
The intention is indeed to rollback every action taken since the last endTransaction, and according to Tim’s research, it does this on the database side of things, which is good, because that was what i was looking for. To further explain why i would prefer not to use the rollback function is because i would like a much larger set of objects, not all of the same type to be rollbacked at the same time, without keeping a list of these objects and looping over them.
Next question based on answers:
However, i would also like to revert all in-memory changes made to the objects, any of you aware whether this is possible? (is it possible to set/renew the context, to a new context?).
Thanks!