This is a solution in the ORM.java file. Replace the existing method with
public static Boolean cloneObject(IContext c, IMendixObject source,
IMendixObject target, Boolean withAssociations)
{
Map<String, ? extends IMendixObjectMember<?>> members = source.getMembers(c);
for(String key : members.keySet()) {
IMendixObjectMember<?> m = members.get(key);
if (m.isVirtual())
continue;
if (m instanceof MendixAutoNumber)
continue;
if (withAssociations || ((!(m instanceof MendixObjectReference) && !(m instanceof MendixObjectReferenceSet))))
target.setValue(c, key, m.getValue(c));
}
return true;
}
Just checked it, this was fixed for deepClone, but not for normal clone.
A workaround is to change ORM.java line 242 from
if (m.isVirtual())
to
if (m.isVirtual() || m instanceof MendixAutoNumber)
I'll make sure it is part of the next release as well.
We ran into this problem today, we had to enhance the java action adding the a list of member names to exclude. This ensured it skipped the Autonumber.