Android DBFlow Many to Many Relationship -


i using retrofit getting data retrofit model , dbflow models same, want save tables. have 2 models, has many many relationships. question model

@table(database = simplifyadatabase.class) @manytomany(referencedtable =answer.class) public class question extends basemodel {   @column @primarykey @serializedname("question_id") private int questionid;  @column @serializedname("question") private string question;  @column @serializedname("question_answer_id") private int questionanswerid;  @column @serializedname("explanation") private string explanation;  @column @serializedname("category_id") private int categoryid;  @column(defaultvalue = "0") private boolean questionselected;  @column private string note;  @column private int selectedanswerid;  @serializedname("citations") private list<citation> citations = null; @serializedname("answers") private list<answer> answers = null;  public int getquestionid() {     return questionid; }  public void setquestionid(int questionid) {     this.questionid = questionid; }  public string getquestion() {     return question; }  public void setquestion(string question) {     this.question = question; }  public int getquestionanswerid() {     return questionanswerid; }  public void setquestionanswerid(int questionanswerid) {     this.questionanswerid = questionanswerid; }  public string getexplanation() {     return explanation; }  public void setexplanation(string explanation) {     this.explanation = explanation; }  public int getcategoryid() {     return categoryid; }  public void setcategoryid(int categoryid) {     this.categoryid = categoryid; }  public list<citation> getcitations() {     return citations; }  public void setcitations(list<citation> citations) {     this.citations = citations; }  public list<answer> getanswers() {     return answers; }  public void setanswers(list<answer> answers) {     this.answers = answers; }  public string getnote() {     return note; }  public void setnote(string note) {     this.note = note; }  public int getselectedanswerid() {     return selectedanswerid; }  public void setselectedanswerid(int selectedanswerid) {     this.selectedanswerid = selectedanswerid; }   public boolean isquestionselected() {     return questionselected; }  public void setquestionselected(boolean questionselected) {     this.questionselected = questionselected; } } 

and answer model

@table(database = simplifyadatabase.class) public class answer extends basemodel {  @column @primarykey @serializedname("id") private int id;  @column @serializedname("answer_id") private int answerid;  @column @serializedname("answer_name") private string answername;  @serializedname("questions") private list<question> questions = null;  public int getid() {     return id; }  public void setid(int id) {     this.id = id; }  public int getanswerid() {     return answerid; }  public void setanswerid(int answerid) {     this.answerid = answerid; }  public string getanswername() {     return answername; }  public void setanswername(string answername) {     this.answername = answername; }  public list<question> getquestions() {     return questions; }  public void setquestions(list<question> questions) {     this.questions = questions; }  } 

then retrofit questions , answer this

   private void getallquestionsnetworkcall() {     this.showprogress();     this.questionssubscription = this.makeuiobservable(questionservice.getallquestions(appointmentid))             .observeon(androidschedulers.mainthread())             .subscribe(                     questions -> {                         onsuccessquestion(questions);                         this.hideprogress();                      },                     error -> this.hideprogress()             ); } 

this gives me list , how can insert this, please me.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -