How to update column with ORMLite
I want to update catType on the basis of catId. How can I update this catType column with the catId in ORMLite.
ORMLite also supports an UpdateBuilder
. Here's how you could use it:
UpdateBuilder<Category, Integer> updateBuilder = catDao.updateBuilder();// set the criteria like you would a QueryBuilderupdateBuilder.where().eq("categoryId", 5);// update the value of your field(s)updateBuilder.updateColumnValue("catType" /* column */, "BarType" /* value */);updateBuilder.update();
See the UpdateBuilder
docs for more examples.