3

I have model of ActiveAndroid like,

public class Workbook extends Model {

@Expose
@Column(name = "WorkbookID",unique = true, onUniqueConflict = Column.ConflictAction.REPLACE)
private Integer ID;

@Expose
@Column(name = "UserID")
private Integer UserID;

@Expose
@Column(name = "Name")
private String Name;

@Expose
@Column(name = "Descript")
private String Descript;

@Expose
@Column(name = "CategoryID")
private Integer CategoryID;


@Expose
@Column(name = "TotalQuestions")
private Integer TotalQuestions;

@Expose
@Column(name = "TotalCorrect")
private Integer TotalCorrect;

@Expose
@Column(name = "TotalInCorrect")
private Integer TotalInCorrect;

@Expose
@Column(name = "IsCompleted")
private Boolean IsCompleted=false;

public Workbook(){
    super();
   }
  }

This annotation will "onUniqueConflict = Column.ConflictAction.REPLACE" replace entire row where conflict found.but what i suppose to do is change specific column value and rest of column values should remain unchanged. As INSERT OR REPLACE will do. In my case want to change only column (UserID, Name, Descript, CategoryID, TotalQuestions) and rest of column(TotalCorrect, TotalInCorrect, IsCompleted) value remains same it is.

Can any one know how to achieve this with Active Android?

Thanks in Advance :)

Nidhi
  • 148
  • 1
  • 1
  • 7

1 Answers1

1

I have tried a lot but its negative. finally i approached if else condition to insert or replace together. May be my answer will useful to who is want to do this kind to operation. it is tricky and worse solution.

   if(condition)
   //do stuff for insertion operation
   else
   //do stuff related to update
Nidhi
  • 148
  • 1
  • 1
  • 7