A Collection of Rows Example
Set quantity to zero for ACME manufacturer.
// set up
Database database = new Database(getConnection());
Table<Inventory> inventoryTable = database.getTable(Inventory.class);
// for all inventory of manufacturer
// "manf" is name of where annotation in Inventory.java
List<Inventory> list = inventoryTable.selectAllWhere("manf", "ACME");
for (Inventory inventory: list)
{
inventory.setQuantity(0);
}
// update
inventoryTable.updateAll(list);
INVENTORY schema and Inventory.java used by this example.
See SimpleExample.java class is in the Simple Example download.
|