Backendless Version 5.0.+
Client SDK Android
I am trying to load a Relation and the parent is an BackendlessUserobject and the child has the type MyObject. I am using an LoadRelationsQueryBuilder and the response should be of the type List but instead it has the type Arraylist<Hashmap<String,Object>>. The Data in the Hashmap is correct but its not MyObject.
I also tried the function Backendless.Data.mapTableToClass.
That is the code I am using:
LoadRelationsQueryBuilder<MyObject> loadRelationsQueryBuilder = LoadRelationsQueryBuilder.of(MyObject.class);
loadRelationsQueryBuilder.setRelationName("pinned");
Backendless.Data.mapTableToClass("MyObject",MyObject.class);
Backendless.Data.of(BackendlessUser.class).loadRelations(BackendlessUser.getUserId(), loadRelationsQueryBuilder, new AsyncCallback<List<MyObject>>() {
@Override
public void handleResponse(List<MyObject> response) {
}
@Override
public void handleFault(BackendlessFault fault) {
Log.d("err", fault.getDetail());
}
});
Thanks in advance for any help
Hello Bernhard,
Please upgrade the Backendless sdk dependency to the latest version first (6.1.1).
Also please show what MyObject class looks like.
Regards,
Mark
I upgraded the Backendless dependency to 6.1.1 still not working.
This is the MyObject:
package com.example.xperience1;
import java.io.Serializable;
import java.util.Date;
public class MyObject implements Serializable {
private Date created;
private Date updated;
private String objectId;
private String ownerId;
private String title = "";
private String description = "";
public MyObject(){
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public Date getUpdated() {
return updated;
}
public void setUpdated(Date updated) {
this.updated = updated;
}
public String getObjectId() {
return objectId;
}
public void setObjectId(String objectId) {
this.objectId = objectId;
}
public String getOwnerId() {
return ownerId;
}
public void setOwnerId(String ownerId) {
this.ownerId = ownerId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}
Thanks. Please let me know your application ID as well.
Regards,
Mark
My Application ID is: 53F60FB5-E0AF-457D-FF50-ED080AC38500
It is concerning the Datatable “Xperience” and MyObject was just a class representing the Class Xperience. Can I send you the code of the actual Class in private?
So MyObject is not a real class? You were substituting it with something else before posting here?) Yes, send the actual code you use to retrieve data and the class to support@backendless.com along with a link to this topic.
Thanks, we will be looking into it today
Hi Bernhard,
The problem is in the Xperience
class, the class itself must be declared public. Without the public
declaration, Backendless has no way of creating an instance (even with the public constructor).
Regards,
Mark
Thanks for your help what a dump mistake
You are welcome. Please don’t hesitate to contact us again if/when you need any help.
Regards,
Mark
1 Like