Fix for issue #677: Set the back reference

When calling add...() on an BaseObject to add a crossreference, the generated code now sets the backreference on the Object that is given to the add function.
This ensures that all references are already set when the object is still not saved.

On the other hand I add a clone in the hasCode function to ensure that the the hasCode function never ever changes the original request as it is not necessary.