My application need to store Model_A into SQLITE database, and Model_A include a ArrayList of Model_B as I describe in example code below:
class Model_A {
String name;
String description;
int number;
List<Model_B> list_Model_B;
}
class Model_B {
String title;
int quantity;
}
I searched and know that I can use GSON (or JSONObject) to convert Model_B to a json String file and store this json in Table of Model_A. But this way is not good for handling the data. I just want to do it without using GSON. I thought about create two table for Model_A and Model_B. Table of Model_A will store a column ID of Model_B. But this way only can store a object Model_B, not a List as I expect.
Can you let me know how to design the database reach my expect ? Or please suggest me a library which can help me on this case. Thanks.
Aucun commentaire:
Enregistrer un commentaire