I'm using greenDAO 3.1 for one of my projects. Since I needed my id to be UUID
I've decided to store it as ByteArray
. Now the problem is I can't update my entities using update
or updateInTx
method and I have to use insertOrReplace
or insertOrReplaceInTx
method.
Can anybody tell me what is going on and why can't I update using update
methods?
Is there any downside to using insertOrReplace
methods instead of update
methods?
This is my Entity
's schema code:
Entity book = schema.addEntity("Book");
book.addByteArrayProperty("id").columnName("_id").primaryKey();
book.addStringProperty("title");
book.addByteProperty("edition");
book.addStringProperty("authors");
book.addStringProperty("desc");
book.addStringProperty("pic");
And here's my update code:
BookDao bookDao = daoSession.getBookDao();
List<Book> books = bookDao.loadAll();
for (Book book : books)
book.setDesc("It doesn't really matter!");
bookDao.updateInTx(books); //This isn't working