Skip to content

Commit

Permalink
Add update data part.
Browse files Browse the repository at this point in the history
  • Loading branch information
sinyu890807 committed Aug 25, 2014
1 parent 878f110 commit 9dfecd2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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");
```

0 comments on commit 9dfecd2

Please sign in to comment.