Reputation: 902
I'm trying to retrieve rows from a table that has the cols:
ACL
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("PartiesInvites");
ArrayList<ParseObject> partiesId = new ArrayList<>();
for (int i = 0; i < mParties.size(); i++) {
partiesId.add(mParties.get(i).getObjectId());
Log.d("UU-UPIL", "partyId = " + partiesId.get(i));
}
query.whereContainsAll("PartyId", partiesId);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> partiesInvitationsIn, ParseException e) {
Log.d("UU-UPIL", "finding parties invitations");
if (e == null) {
for (int i = 0; i < partiesInvitationsIn.size(); i++) {
Log.v("UU-UPIL", partiesInvitationsIn.get(i).getObjectId());
}
mPartiesInvitations = partiesInvitationsIn;
Log.d("UU-UPIL", String.valueOf(partiesInvitationsIn.size()));
} else {
e.printStackTrace();
}
}
});
This is the exception I'm getting
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ com.parse.ParseException: java.lang.IllegalStateException: A ParseObject subclass default constructor must not make changes to the object that cause it to be dirty.
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.Parse$6$1.run(Parse.java:971)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at android.os.Handler.handleCallback(Handler.java:733)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at android.os.Handler.dispatchMessage(Handler.java:95)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at android.os.Looper.loop(Looper.java:212)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at android.app.ActivityThread.main(ActivityThread.java:5135)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at java.lang.reflect.Method.invokeNative(Native Method)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at java.lang.reflect.Method.invoke(Method.java:515)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:877)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:693)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ at dalvik.system.NativeStart.main(Native Method)
02-11 13:06:03.907 28398-28398/com.whoCare.noOne W/System.err﹕ Caused by: java.lang.IllegalStateException: A ParseObject subclass default constructor must not make changes to the object that cause it to be dirty.
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseObject.createWithoutData(ParseObject.java:257)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseObject.fromJSON(ParseObject.java:524)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseObject.fromJSON(ParseObject.java:499)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseQuery.convertFindResponse(ParseQuery.java:386)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseQuery.access$600(ParseQuery.java:80)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseQuery$6.then(ParseQuery.java:567)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at com.parse.ParseQuery$6.then(ParseQuery.java:558)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at bolts.Task$9.run(Task.java:444)
02-11 13:06:03.917 28398-28398/com.whoCare.noOne W/System.err﹕ at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:97)
I tried changing the query from "whereContainsAll" to "whereContainedIn" but I keep getting the same exception. is there is anything wrong in my code !?
Upvotes: 0
Views: 267
Reputation: 952
A ParseObject subclass default constructor must not make changes to the object that cause it to be dirty.
I'm not sure if you have a subclass from parseObject somewhere in your code that you're using to put the database entry into, but this exception is raised when you modify the item in the constructor of that subclass
From Parse.com/android
Ensure that your subclass has a public default (i.e. zero-argument) constructor. You must not modify any ParseObject fields in this constructor.
Upvotes: 2
Reputation: 827
Change this
query.whereContainsAll("PartyId", partiesId);
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> partiesInvitationsIn, ParseException e) {
Log.d("UU-UPIL", "finding parties invitations");
if (e == null) {
for (int i = 0; i < partiesInvitationsIn.size(); i++) {
Log.v("UU-UPIL", partiesInvitationsIn.get(i).getObjectId());
}
mPartiesInvitations = partiesInvitationsIn;
Log.d("UU-UPIL", String.valueOf(partiesInvitationsIn.size()));
} else {
e.printStackTrace();
}
}
});
To this
query.whereContainsAll("PartyId", partiesId);
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> partiesInvitationsIn, ParseException e) {
Log.d("UU-UPIL", "finding parties invitations");
if (e == null) {
for (int i = 0; i < partiesInvitationsIn.size(); i++) {
Log.v("UU-UPIL", partiesInvitationsIn.get(i).getObjectId());
}
mPartiesInvitations = partiesInvitationsIn;
Log.d("UU-UPIL", String.valueOf(partiesInvitationsIn.size()));
} else {
e.printStackTrace();
}
}
});
Basically just add an @Override before done method
Upvotes: 0