Hi. I have a Backendless object called Part. I add text and other stuff to the fileds of the Part object that have corresponding column names in the Backendless backend. But when I call save, the saved returned object have fields all pointing to null, except objectId. Here is my code:
final Part part = new Part();
ser = DataStorageSingleton.getInstance().getUser();
part.setText(text);
part.setStory(story);
Backendless.Persistence.save(part, new AsyncCallback<Part>() {
@Override
public void handleResponse(Part response) {
}
@Override
public void handleFault(BackendlessFault fault) {
}
});
//My Part class
public class Part {
private String ownerId;
private String text;
private java.util.Date created;
private java.util.Date updated;
private String objectId;
private Story story;
private List<BackendlessUser> likes;
private BackendlessUser author;
private List<Flag> flags;
//rest of the class omitted.
Hi Ludwig,
Have you checked whether there is any response? Maybe error inside the error handler?
I get a positive response with the saved object returned. I can also see the object in the Database, all field empty except objectId.
Do you have getters in your class?
Yes. I used the code generation you provide to build the class as well.
I switched from the lastest working gradle dependency (3.0.3) to the latest jar instead.
Now the data is stored in the Database, but your SDK crashes:
java.util.NoSuchElementException
Line 104:
if(!(entry.getValue() instanceof Collection) || ((Collection)entry.getValue()).iterator().next() instanceof GeoPoint) {
continue;
}
In the FootprintsManager class.
Okej this is getting more and more strange. When I tried the request again it didn’t crash, and I got this error:
BackendlessFault{ code: ‘1001’, message: ‘Cannot update object without any properties: properties’ }
I have debugged the object and I am sure It have all the required properties set.
Ludwig,
We pushed the latest code into Maven over the weekend and are waiting till Maven central approves the build.
Meanwhile, could you download the SDK from our website and get the jar from there?
Regards,
Mark
Says I did that in the comment you just commented on 
I just downloaded the latest SDK and ran the following code. It ran without any problems at all. I’ll be happy to try your project if you’d like to zip up and email it to me.
Backendless.initApp( APP_ID, SECRET_KEY "v1" );
final Part part = new Part();
part.setText("test text");
Story story = new Story();
part.setStory(story);
Backendless.Persistence.save(part, new AsyncCallback<Part>() {
@Override
public void handleResponse(Part response) {
System.out.println( "object saved" );
}
@Override
public void handleFault(BackendlessFault fault) {
System.out.println( "got fault" );
}
});
Part class:
package com.mbaas;
public class Part
{
public String getOwnerId()
{
return ownerId;
}
public void setOwnerId( String ownerId )
{
this.ownerId = ownerId;
}
public String getText()
{
return text;
}
public void setText( String text )
{
this.text = text;
}
public Story getStory()
{
return story;
}
public void setStory( Story story )
{
this.story = story;
}
private String ownerId;
private String text;
private Story story;
}
Story class:
package com.mbaas;
public class Story
{
public String objectId;
}
Okej I have tried some more things now and here is my observations:
Part part = new Part();
EverbookUser user = DataStorageSingleton.getInstance().getUser();
part.setText(text);
part.setStory(story);
part.setAuthor(user);
If I set my user also, it’s a class that extends BackendlessUser, then the request fails and says the fields are empty.If I then remove setUser(), it crashes instead:java.util.NoSuchElementException
at java.util.ArrayList$ArrayListIterator.next(ArrayList.java:576)
at com.backendless.FootprintsManager$Inner.duplicateFootprintForObject(FootprintsManager.java:172)
And if I then also remove setStory(), then it is actually working. So it seems I have some problems with the relations.
Extending BackendlessUser is not a good idea, I would not recommend it. May I take a look at your project? I’d love to be able to reproduce the problem on our side, it would go long way for fixing it.
Regards,
Mark
Sure, do you have an email? Rather not post the project here.
Of course: mark@backendless.com. Thanks!
Update on this. One of the errors was that I subclass BackendlessUser and create a new user from my user data, without setting the custom properties.
The other problem still remains though, as I am not able to set a relation to a Story. Still get the crash: duplicateFootprintForObject.
The crash has been fixed, thanks Backendless team.