Retrive relation from user problem Android Studio

Ive tried to retrive a one to one relation but I managed to retrive an object type which conains the info that i need, user.getproperty(“”) .

but i cant reach to that info (The dubug section in image).
thanks for help
attached file is my code while debugging after loggin in

Hello!
You should cast the retrieved object to its class.
Here is how it should look like, assuming that your class is “Place”

Place retrievedPlace = (Place)response.getProperty( "Places" );

Do not forget to make mapping before calling any persistence methods. For example, you can do it in onCreate() method of your main class. Code of mapping looks like this:

Backendless.Data.mapTableToClass( "Place", Place.class );

Also be sure that the class is correct - it should include all getters and setters and default no-argument constructor.
Hope it helps.
Alex

Thanks Alex but unfortonatly its not working i get an error

this error happens
java.lang.ClassCastException: java.util.HashMap cannot be cast to com.example.avihu.verifitytest1.Places

with this line
Places retrievedPlace = (Places)response.getProperty( “Places” );

maybe its because not all colums contained in Places(see attached file)

pic12.png

Have you made mapping as I described in previous post?

yes , put it in onCreate after init

Backendless.Data.mapTableToClass( "Places", Places.class );

Looks like your “Places” class doesn’t have no-argument constructor and field “name” doesn’t have getters and setters.

public class Places {
String name;
int pid;

public Places(int pid, String name) {
    this.pid = pid;
    this.name = name;
}

public int getPid() {

    return pid;
}

public void setPid(int pid) {
    this.pid = pid;
}

public String getName() {
    return name;
}

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

}

Still no needed constructor.

Add the following:

public Places() {
}

Thanks!!! :slight_smile: