1

How set objectId with Parse.com with primary key.Can you help me ? When i create new row, i want setObjectId of row.

  final ParseObject parseObject = new ParseObject(ChapsModel.PARSE_OBJECT);
            parseObject.put(ChapsModel.PARSE_FIELD_NAME_CHAPS,
                            chapsModel.get(i)
                                      .getNamChap());
            parseObject.put(ChapsModel.PARSE_FIELD_LINK_CHAP,
                            chapsModel.get(i)
                                      .getLinkChap());
            parseObject.put(ChapsModel.PARSE_FILED_TEAM_TRANSLATE,
                            chapsModel.get(i)
                                      .getTeamTranslate());
            parseObject.put(ChapsModel.PARSE_FIELD_OBJECT_MANGA,
                            ParseObject.createWithoutData(MangaModel.PARSE_OBJECT,
                                                          chapsModel.get(i)
                                                                    .getObjectManga()));
            parseObject.saveInBackground(new SaveCallback() {
                @Override
                public void done(final ParseException e) {
                    if (e == null) {
                        Log.e(">>>>>",
                              "done" + ojectId);
                  //      parseObject.setObjectId(ojectId);

                    } else {
                        Log.e(">>>>>",
                              "else" + e.getMessage());
                    }
                }
            });

Log

java.lang.RuntimeException: objectIds cannot be changed in offline mode.

Log: Sorry my english. thank

2
  • 2
    Not sure how to do it, but why do you want to change the object id? Commented Nov 2, 2015 at 15:52
  • 1
    because i have save id with hashcode. Commented Nov 3, 2015 at 3:22

1 Answer 1

2

It's not possible to set objectId with Parse.com with primary key.

Although parse.com doesn't allow us to set the objectId of a row, you can create a new column named anything you want and you can set that new column to any objectId you want. For example, you can create a new column named myObjectId and set it to a string.

From the parse.com website at https://www.parse.com/docs/js/guide#cloud_code The Data Browser

The Data Browser is the web UI where you can update and create objects in each of your apps. Here, you can see the raw JSON values that are saved that represents each object in your class.

When using the interface, keep in mind the following:

The objectId, createdAt, updatedAt fields cannot be edited (these are set automatically).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.