Like the title,
suppose we have a Collection-holder Persistable class, i called it ThingsHolder in detached state with all of it's relationships fetched, then we add an element E in a position that is not the last (i.e. at the beginning); if we then proceeds to persist this dirty object while having datanucleus.cache.collections=false we obtain an index out of bounds.
I am attaching the full buildable testcase for Datanucleus 5.2
dn-bug-attachcopy-testproject.zip