I have a 1:1 relation set up in table A.
Calling the .setRelation function with the following signatures does not override the old relation, rather appends it (like you would expect with the addRelation function).
Backendless.Persistence.of(TABLE_CLASS).setRelation(parentObject, "columnName:TableName:1", Arrays.asList(relationObject));
Backendless.Persistence.of(TABLE_CLASS).setRelation(parentObject, "columnName", Arrays.asList(relationObject));
I tried both signatures - one with the cardinality syntax and without. No matter where I call this .setRelation function, the same behaviour is observed (tested this in a server code function, as well as on iOS).
The odd part is that this should not be possible at all, especially when the schema is explicitly set to a 1:1 and not a 1:N. The backendless console even displays that somehow, two objects are set (in this case), regardless of it being a 1:1. Clicking on the relation will still filter down and display the N records that are “set” in the other table.
http://support.backendless.com/public/attachments/68fd91f84148fd155dc8ddffb72030bd.png</img>
On a related note, I am trying to set a relation to the User table (also 1:1), and the operation fails because the objectId of the user is seen as null (also observed this in both server code and via iOS SDK).
Error Returned:
FAULT = '1303' [Unable to create relation. Child object with id 'null' is not found in the related table.] <Unable to create relation. Child object with id 'null' is not found in the related table.>
I have verified that the user’s objectId is in fact not null, before passing it off to the set relation function in iOS or the cloud code function. This issue seems to just be with the Users table - I don’t get the null error with the other relations that I try to set.
Any help is greatly appreciated!
Thanks,
Renato