Cant get table relationship data

Hi, I am having a issue that I can seem to to solve. I am trying to create instances of relationship data i.e. Person table data and Slot table data, my setup is the relation goes through Users > Person > Slot, I have set auto load ticked for the columns where the object relations exist. Currently when I login a User the User instance has all the relationship info attached to it as expected but I cant seem to get a hold of the relationship: Person or Slot data,
Using the user.getProperties() gets the entrys with the values but I cant get a hold of the relationship data, I also tried doing it this way:

Users users = Backendless.Persistence.of(Users.class).findFirst();// Users : Name of the Table, get first person but will be getting the logged in users relationship
dataArrayList<String> relationProps = new ArrayList<String>(); //persons : column table in users that has a 1:1 relationship to person from Users
relationProps.add(“persons”); // column in the Users table, for Person table.
//relationProps.add(“persons.slot”); // Will need to be extended, slot is column in Person table
Backendless.Persistence.of(Users.class).loadRelations(users, relationProps);

When I do it this way above I always seem to be getting a BackendlessException{ code: ‘Internal client exception’, message: ‘null’ } on the first line of code.

I have included Backendless.Persistance.mapTableToClass(“Users”,Users.class); and mapTableToClass for my other two tables and classes.

All I want is to create instances of the relationship data for Person and Slot (and Users) from my classes already setup

Thanks.
Leonard

Hi Leonard,

Here’s what I have done:

    Created Person and Slot tables: http://support.backendless.com/public/attachments/d8566e182b79e1dfada282d05730bfe9.jpg</img> http://support.backendless.com/public/attachments/b1cbdacef94e170d6976e1f851c2c86c.jpg</img> Created a one to many relation between Users table and Person: http://support.backendless.com/public/attachments/c492ff30a81d188e8eb10a129bcbe4bb.jpg</img> Added a few records for Person, Slots and also registered a user. Also, selected "autoload" in the Users table for the "persons" column: http://support.backendless.com/public/attachments/390c3d24ae26a3202436b89b3a2f25ee.jpg</img>

    http://support.backendless.com/public/attachments/844dfd98f8f7d4a9612c79f0f4172e32.jpg&lt;/img&gt;

    Now on to the code. I create Person class:

[code]

package com.backendless.sample;

public class Person
{
private String name;

public String getName()
{
    return name;
}


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

}

[/code]
And then ran this code:

package com.backendless.sample;


import com.backendless.Backendless;
import com.backendless.BackendlessUser;


public class PersonSlotDemo
{
  public static void main( String[] args )
  {
  // this line of code can be removed. In this case, the "getProperty("persons")" call will
  // return an array of HashMap objects.
    Backendless.Data.mapTableToClass( "Person", Person.class );


    Backendless.initApp( APP_ID, SECRET_KEY, "v1" );
    BackendlessUser loggedInUser = Backendless.UserService.login( "mark@backendless.com", "password" );
    Person[] obj = (Person[])loggedInUser.getProperty( "persons" );
    System.out.println( obj.length );
  }
}

Works exactly as expected. Notice that mapping BackendlessUser to Users is not necessary and just wrong. The class and table are special and should never be mapped to anything.