get parent object from child object relation

I read https://backendless.com/docs/android/doc.html#data_inverted_relation_retrieval

but all of example are load a collection of child objects for a specific parent object.
In example, find contacts for a specific phone book.
how do I find phone book for a specific contact. Please, show me code example.

That’s very easy - send a query with the following whereClause to the PhoneBook table:

contacts.objectId = 'SPECIFIC CONTACT OBJECTID'

I can’t use auto load in order to load User when load answers. I want to get answers from question.objectId specific
and sort them by created(at first, I use LoadRelationsQueryBuilder but it don’t have setsortby() so, I use invert relation retrieval) but auto load not work, return answer.getUser()==null.

String whereclause = "Question[answers].objectId = '"+question.getObjectId()+"'"; 
 DataQueryBuilder dataQueryBuilder = DataQueryBuilder.create(); 
 dataQueryBuilder.setWhereClause(whereclause); 
 dataQueryBuilder.setSortBy("created ASC"); 
 Backendless.Data.of(Answer.class).find(dataQueryBuilder, new AsyncCallback<List<Answer>>() { 
 @Override 
 public void handleResponse(List<Answer> response) { 
 listAnswer = (ArrayList<Answer>) response; 
 Log.d("kiemtrauser","so user="+response.size()); 
 if(response.get(0).getUser() ==null){ 
 Log.d("kiemtrauser","user=null"); 
 }else{ 
 Log.d("kiemtrauser","email="+response.get(0).getUser().getEmail()); 
 } 
 } 
 
 @Override 
 public void handleFault(BackendlessFault fault) { 
 
 } 
 });


I try use dataQueryBuilder.setRelated(“user”); but result is not change.

What version of the SDK do you use?

4.0.0

http://support.backendless.com/public/attachments/5ec15476434d981e05067ba53df3b03d.PNG</img>

Do inverted retrieval is advanced object retrieval?

We have 3 releases of 4.0.0:

4.0.0-beta1
4.0.0-beta2
4.0.0-beta3

Which one do you use?

I use 4.0.0-beta1

Make sure to update to beta3, we had a few fixes related to object retrieval there.

Question(answers, user,…) -> answers and user are relation columns
Answer(user,…) -> user is relation column point Users(default)
class Question, Answer have property BackendlessUser user;

thanks. It;s work for me.

I have a problem, when I update a Question object.

public class Question implements Serializable{ 
 private String objectId; 
 private BackendlessUser user; 
 private String content; 
 private boolean is_reply; 
 private Date created; 
 private Date updated; 
 
 public Question() { 
 }


why console create new field “_reply” and update is_reply’s value to this field?

If this is not related to the original question in this topic, please create a new one.

Thanks!