Can we update the collection like below? It does not work. Thanks.
Backendless.Persistence.of(Person.class).find(dataQuery, new AsyncCallback<BackendlessCollection<Person>>() { @Override
public void handleResponse(BackendlessCollection<Person> personBackendlessCollection) {
//loop through the return collection, set new values
for (Person person : personBackendlessCollection.getData()) {
person.setClass(“New class”);
person.setRoom(“New room”);
}
//save the updated collection
Backendless.Persistence.save(personBackendlessCollection, new AsyncCallback<BackendlessCollection<Person>>() { @Override
public void handleResponse(BackendlessCollection<Person> personBackendlessCollection) {
}
@Override
public void handleFault(BackendlessFault backendlessFault) {
}
});
} @Override
public void handleFault(BackendlessFault backendlessFault) {}
});
This approach will not work. You can update either one object at a time. To update a collection of objects you can use one of the following approaches:
Save the parent object with a collection of children objects which will be persisted/updated as well
Use bulk update, but it is available only with the REST API (search for "bulk update" in the following document):
http://backendless.com/documentation/data/rest/data_updating_data_objects.htm
Regards,
Mark
I understand, but if you need to update multiple objects with a single request, you can do it by either using the REST API call I described earlier or create your own service in Backendless API Engine and process the request on the server-side. With this approach you will make a single call on the client-side, but on the server, you will be saving objects one by one.
I don’t know what happen to my Data Tab on the Backendless server. I got this message when click on Data tab under Users tab.
<html> <head><title>504 Gateway Time-out</title></head> <body bgcolor="white"> <center><h1>504 Gateway Time-out</h1></center> <hr><center>nginx/1.4.2</center> </body> </html> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page --> <!-- a padding to disable MSIE and Chrome friendly error page -->