diff --git a/README.md b/README.md index e2d863b1..39b34e7c 100644 --- a/README.md +++ b/README.md @@ -175,3 +175,17 @@ song2.setDuration(356); song2.setAlbum(album); song2.save(); ``` + +#### 3. Update data +Each model which inherits from **DataSupport** would also have **update()** and **updateAll()** method. You can update a single record by a specified id: +``` java +Album albumToUpdate = new Album(); +albumToUpdate.setPrice(20.99f); // raise the price +albumToUpdate.update(id); +``` +Or you can update multiple records by a where condition: +``` java +Album albumToUpdate = new Album(); +albumToUpdate.setPrice(20.99f); // raise the price +albumToUpdate.updateAll("name = ?", "album"); +```