User bio
404 bio not found
Member since May 26, 2022

Hi Yaron, thanks for giving a test with the code example above. And the statement you referred is indeed from the documentation.

Yet to me the "transaction" mentioned is a bit ambiguous. I would rather interpret it as an explicit transaction demarcated by a TSTART and a TCOMMIT (or TROLLBACK) in the calling method.

Let me continue with your example here. This time I would like to add TSTART and TCOMMIT for the scope of the transaction, and there in the transaction I would like to add and save the second object:

USER>s obj=##class(USER.TestClass).%New(), obj.Name="Name", sc=obj.%Save() w !,sc
USER>zw ^USER.TestClassD
USER>s obj=##class(USER.TestClass).%New(), obj.Name="Name2", sc=obj.%Save() w !,sc
USER>zw ^USER.TestClassD

And what I really expect to see is, the %OnSaveFinally() method of those 2 objects will be called at the point just after TCOMMIT in my example, not after their own %Save() respectively.

Certifications & Credly badges:
Joseph has no Certifications & Credly badges yet.
Global Masters badges:
Joseph has no Global Masters badges yet.
Joseph has no followers yet.
Joseph has not followed anybody yet.