Start a new topic

Get Entities which contains a specific KinveyRef

Hi!



On Android i need get a list of entities with specific KinveyRef, for example :



Query q = mKinveyClient.query();

KinveyReference reference = new KinveyReference();

reference.setId(id);

reference.setCollection("CollectionName");

q.equals("collectionNameRef", reference);



AsyncAppData myData = mKinveyClient.appData("MyEntity", MyEntity.class);

myData.get(q, new KinveyListCallback() {

@Override

public void onFailure(Throwable t) {



}

@Override

public void onSuccess(MyEntity[] myEntities) {





}

}

});





But don't have any result. How I do?

1 Comment

First, you need to set that KinveyReference to be the value within a `MyEntity` object. In your code, you have an object called `reference` but you will need to set that on an entity. Then, after that, you will need to upload the modified entity to the backend using the save method.



Then, finally, you can do a query for the `MyEntity` and resolve the value of the reference.





take a look at our relational data guide, which might explain these concepts better:

http://devcenter.kinvey.com/android/guides/datastore#RelationalData
Login or Signup to post a comment