I am using sugar orm in my android project . I am tesing this example :
Author model :
public class Author extends SugarRecord<Author> {
String name;
}
Book model :
public class Book extends SugarRecord<Book> {
String name;
String ISBN;
String title;
String shortSummary;
// defining a relationship
Author author;
}
This is the test case :
Author author = new Author();
author.name = "John";
author.save();
Book book = new Book();
book.name ="some name";
book.ISBN ="some ISBN";
book.title="some title";
book.shortSummary="short summary";
book.author= author;
book.save();
In this case the author field in the book table is always null.
Where is my mistake ? Please any help
Aucun commentaire:
Enregistrer un commentaire