Question concerning the repetition index of repeatable groups in document models

Question on behalf of @hieu-frosted-bay
Hi, I have a question concerning the repetition index of repeatable groups in document models:
Is it guaranteed that the order of the groups is preserved, i.e. that e.g. an EntityInstance with pathToInstance = “/Items[2]/Name[1]” is always accessible with this repetition array [2,1] after saving and reloading the document?

Repeatable groups are lists, i. e. the order of their elements is stable. Of course the indices change when the document is manipulated (e.g. repetitions are deleted / added at the front).

Hi @hieu-frosted-bay, it depends on the implementation of com.mgmtp.a12.kernel.md.document.api.IDocument which you are using. Strictly speaking, there is a java.util.Set behind the management of EntityInstances (see IDocument#getEntityInstances). The internal implementation of kernel (used per default while deserializing a document if nothing else configured) uses an own implementation which preserves the order of the EntitiyInstances. As far as I know, DataServices uses the kernel implementation.