Hello,
I have encountered a problem regarding adding friends (BackendlessUser) to friends list (DATA TYPE: Data Relation 1:N Users) in Users SYSTEM DATA database.
After adding programmatically a 1:N relation on Backendless Users database (Backendless.UserService.update), response comes OK, there is a relation 1:N created on backendless console (I can see it very briefly), but after about a second database reloads itself and created relation disappears. What could possibly be the cause?
APP ID: F6FFA6BB-A366-44DE-FF75-C17E39E1DA00
Best regards
Hi @Jakub_Nowak
To establish relations between data objects you can’t use update
method, you have to use add/set Relations
Regards, Vlad
1 Like
First of all, thank you for your quick reply.
So I have now managed to create a relation inside a dummy table, but not inside **Users** table. When I try to change *tableName* parameter to **BackendlessUser.class** the error comes 'cannot resolve method...'.
My relation adding code:
HashMap<String, Object> parentObject = new HashMap<String, Object>();
parentObject.put("objectId", "<object-id>");
Backendless.Data.of("dummyTable").addRelation(
parentObject,
"<dummy Column With 1:N relation set>",
"name = 'Alice' or name = 'Bob'",
new AsyncCallback <Integer>() {
@Override
public void handleResponse(Integer response) {
}
@Override
public void handleFault(BackendlessFault fault) {
}
}
);
Error generating change:
Backendless.Data.of("dummyTable").addRelation
Backendless.Data.of(BackendlessUser.class).addRelation
Hi @Jakub_Nowak!
Can you provide full stack-trace of your error?
Regards, Andriy
1 Like
It turned out I was just using wrong parameters in addRelation() function and everything is working fine now.
Thank you for your help guys and have a bug-free and happy new year