I'm working with ActiveAndroid library, I have the following problem: I hace two class for my database. Person and PersonPhoto. Every person has only one photo, and photo is only for one person.
These is my code.
@Table(name = "Person")
public class Person extends Model{
@Column(name = "name")
public String name;
@Column(name = "photo")
public PersonPhoto photo ;
public Person() {}
}
this is my second class.
@Table(name = "PersonPhoto")
public class PersonPhoto extends Model {
@Column(name = "name")
public String name;
@Column(name = "photo64Code")
public String photo64Code;
public PersonPhoto() {}
}
In my Activity I have two buttons one for make an random insert and the other one for make and a general retreaving. here the code:
@Override
public void onClick(View view) {
Person p = new Person();
PersonPhoto photo = new PersonPhoto();
photo.setName("photo");
photo.setPhoto64Code("011110");
p.setNickName("user");
p.setPassword("123");
p.setName("user");
p.setfLastName("usera");
p.setsLastName("userb");
p.setLoginStatus(1);
p.setPhoto(photo);
p.save();
p.getPhoto().save();
}
I ran it with my debugger and I saw my list details, all is okay individually But in my Person object I don't have my photo reference. its marked like a null.
I don't know how to insert a nested object with ActiveAndroid.
I'm working with ActiveAndroid library, I have the following problem: I hace two class for my database. Person and PersonPhoto. Every person has only one photo, and photo is only for one person.
These is my code.
this is my second class.
In my Activity I have two buttons one for make an random insert and the other one for make and a general retreaving. here the code:
my other button calls these method:
I ran it with my debugger and I saw my list details, all is okay individually But in my Person object I don't have my photo reference. its marked like a null.
I don't know how to insert a nested object with ActiveAndroid.
Thanks for read.