/20@yegor256 4
Map attrs = new HashMap();
attrs.put(“title”, “Object Thinking”);
book.updateAttributes(attrs);
Book Base
MySQL
JDBC
UPDATE book
SET title = “Object Thinking”
WHERE id = 555
statement.executeUpdate();
/20@yegor256 9
public class Book {
private final DataSource source;
private final int id;
Book(DataSource db, int id) {
this.source = db;
this.id = id;
}
public void rename(String title) {
new JdbcSession(this.source)
.sql(“UPDATE book SET title=? WHERE id=?”)
.set(title)
.set(this.id)
.update();
}
}