Question

let`s say I have two objects (classes) Category and Work. I want to save new Work with Category relation. Any ideas how to do that?

Was it helpful?

Solution

This is a pretty basic thing covered in the documentation here.

In your case you would have a category property on your Work object that would be an object pointer to a Category class (table).

// assuming you have myWork and myCategory as instances of ParseObject
myWork.put('category', myCategory);

If you only have the objectId of the Category then you do the following:

myWork.put('category', ParseObject.createWithoutData('Category', categoryId));

OTHER TIPS

But now I want to get info from database.

ParseQuery<ParseObject> query = ParseQuery.getQuery("Event");
        query.whereEqualTo("user", userID);

        query.findInBackground(new FindCallback<ParseObject>() {
          public void done(List<ParseObject> commentList, ParseException e) {
              System.out.println(commentList);
          }
        });

And after that I got empty response.

SOLVED.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top