I just started using the ORMlite module for cacheing (Gson for parsing json and Spring for networking) and I have a couple of questions about how this works.
1. From my understanding the caching takes place after loadDataFromNetwork, so whatever is returned from that method is what is run through the caching process, right?
2. The OrmLite documentation states that "if your foreign object has a generated-id which is provided by the database then you need to create it before you create any objects that reference it ", but from what I could deduce from the source code this is taken care of. Correct? If so, is there any limitation on how many levels of nesting I can have?
3. Is it possible to access and manipulate the database outside of the Robospice controll
4. What the hell am I doing wrong? =) The most simple use case is fetching a User with a UserName foreign field. Somewhat simplified the classes look like this:
public class User{
@DatabaseField(generatedId=true)
private int _id;
@DatabaseField
public String gender;
@DatabaseField(foreign = true, foreignAutoRefresh = true)
public UserName name;
}
public class UserName{
@DatabaseField(generatedId=true)
private int _id;
@DatabaseField
public String preferred;
}
The tables are created as the should and the gender field is persisted in the database but not the name field. I always get the default 0 and the username table is empty.
I know the ORMLite module is still in beta and I guess I should ask ORMLite specific questions on SO or ORMLite user groups, but I have to try. =)
Thanks in advance
//Viktor