retrieve user's relationship related properties

Hi. I hava a one to many relationship of users with ‘Skills’ table. After login I want to retrieve all the Skills related to that user. I have attached a picture of my console to show the relationship.
I have done this, but application got crashed. The error is
java.lang.ClassCastException: java.util.HashMap[] cannot be cast to java.util.Objects[]
My code is :

BackendlessUser currentUser = Backendless.UserService.CurrentUser();
Object[] userSkills = (Objects[]) currentUser.getProperty("skills");
String s = "";
if(userSkills!=null && userSkills.length>0){
 Skills[] skillArray =(Skills[]) userSkills;
 for (int i=0;i<skillArray.length;i++){
 s="Skill is null";
Log.d("Users Skills: ",s);

error happens on second line.

Hey Mubtada

Did you tried to use HashMap[] instead Object[]?

HashMap[] userSkills = (HashMap[])currentUser.getProperty("skills");

Regards, Vlad

Try to add this line before you make any API calls to the server:

Backendless.Data.mapTableToClass( “Skills”, Skills.class );


using HashMap [] it works fine. but it did not map ‘Skills’ class to ‘Skills’ table even after this line Backendless.Data.mapTableToClass( “Skills”, Skills.class );
it returns in the form of hashmap. but i want in objects of ‘Skills’ Class. and if type cast hashmap in Skills class object it shows an error of inconvertible type.

Did you see my comment here? That will take care of mapping the server-side data to the client-side class.

thanks it worked.