How get all the data from a table of the data base

Hi,

I’m new in backendless and this is the first contact that I have with your backend that seems cool. I’m getting some problems when I try to get all the data that I have in one table in my data base.

That I want to do is get all the data of one/all row (name, description and location) in one object to can handle in the client. I’m using Android Studio.
With the code of below I’m only getting the name of my data, and description and location I’m getting null. I have spent some hours in this and I don’t know why I’m not getting all the object.

I attached you a jpg of my database

Thanks,

I’m doing this in to retrieve the data:

Backendless.Persistence.of( Beach.class).find( new AsyncCallback<BackendlessCollection<Beach>>(){
@Override
public void handleResponse( BackendlessCollection<Beach> response )
{
List<Beach> firstPage = response.getCurrentPage();
for( int i = 0; i < firstPage.size(); i++ ) {
Log.e(TAG, firstPage.get(i).getName() + firstPage.get(i).getDescription() + firstPage.get(i).getLocation());
}
}
@Override
public void handleFault( BackendlessFault fault )
{
// an error has occurred, the error code can be retrieved with fault.getCode()
}
});

This is my class Beach

public class Beach{

private String name;
private String description;
private GeoPoint location;


public String getDescription() {
    return description;
}


public void setDescription(String description) {
    this.description = description;
}


public GeoPoint getLocation() {
    return location;
}


public void setLocation(GeoPoint location) {
    this.location = location;
}


public String getName() {
    return name;
}


public void setName(String name) {
    this.name = name;
}

}

I’ve done one advance…

Adding this to the method

QueryOptions queryOptions = new QueryOptions();
queryOptions.addRelated(“location”);
dataQuery.setQueryOptions( queryOptions );

I can get the geopoint, but still can’t get the description!

Then, my question in this point is the same, how can I get all the info of the row??

Get it, I forget to check the edit label in the database… ahggg Yes, I can get all the data know, the three columns, but I want to know one thing at this point,

Why I need to add a queryOptions to get the geopoint?? and not to get the name and description???

Thanks!!

Hi Salva,

Backendless does not return relation columns by default. This is done to minimize the payload. As a result, you need to “request” the relations by using the QueryOptions API.

Regards.
Mark
p.s. since you resolved the problem, I will mark the topic as “Solved”.

Hi Mark,

Yes, thank you for your answer!