sormula | simple (easy) object relational mapping | |
|
You can override the defaults as needed with annotations. Database database = new Database(connection); Table<Inventory> inventoryTable = database.getTable(Inventory.class); // insert Inventory inventory = new Inventory(); inventory.setPartNumber(partNumber); inventory.setManufacturerId("Acme"); inventory.setQuantity(99); inventoryTable.insert(inventory); // select inventory = inventoryTable.select(partNumber); // update inventory.setQuantity(1000); inventoryTable.update(inventory); // delete inventoryTable.delete(inventory); CREATE TABLE INVENTORY ( PARTNUMBER INTEGER PRIMARY KEY, QUANTITY INTEGER, MANUFACTURERID VARCHAR(40) ) public class Inventory { int partNumber; int quantity; String manufacturerId; public int getPartNumber() { return partNumber; } public void setPartNumber(int partNumber) { this.partNumber = partNumber; } public int getQuantity() { return quantity; } public void setQuantity(int quantity) { this.quantity = quantity; } public String getManufacturerId() { return manufacturerId; } public void setManufacturerId(String manufacturerId) { this.manufacturerId = manufacturerId; } } |
Sormula never needs configuration files, SQL, inheritance, or interfaces. Annotations
are optional when:
|
© 2018 Sormula, LLC |