Hi,
I have an app where I want to do a relationship between users and comments and another table. I can update comments with my relation table, but I want to update the comment with the user, too. I’m getting this error when I try to update the user:
BackendlessException{ code: ‘1020’, message: ‘Missing ___class property for entity: properties’ }
This is my code:
currentUserId = Backendless.UserService.loggedInUser();
final BackendlessDataQuery query = new BackendlessDataQuery();
QueryOptions queryOptions = new QueryOptions();
queryOptions.setRelationsDepth(1);
query.setQueryOptions( queryOptions );
query.setWhereClause( "objectId = " + “'” + beachId + “'” );
final BackendlessDataQuery queryUser = new BackendlessDataQuery();
QueryOptions queryOptionsUser = new QueryOptions();
queryOptionsUser.setRelationsDepth(1);
queryUser.setQueryOptions( queryOptionsUser );
queryUser.setWhereClause( "objectId = " + “'” + currentUserId + “'” );
new Thread(new Runnable() {
public void run() {
beachToUpdate = Backendless.Persistence.of( Beach.class ).find(query).getData().get(0);
userToUpdate = Backendless.Persistence.of( Users.class ).find(queryUser).getData().get(0);
}
}).start();
comment = new Comment();
comment.setMessage(getCommentFromUser);
comment.setScore(setFinalRatingNumber);
comment.setAuthorEmail(preferences.getString(MainActivity.USER_NAME, “”));
userToUpdate.setEmail(“myemail@gmail.com”);
userToUpdate.setProperty(“comment”, comment);
userToUpdate.getComment().add(comment);
beachToUpdate.getComment().add(comment);
new Thread(new Runnable() {
public void run() {
Backendless.Persistence.save(beachToUpdate);
Backendless.Persistence.save(userToUpdate);
}
}).start();
I’ve attached a screenshot of my user properties