See: Description
Class | Description |
---|---|
ArrayListSelectOperation<R> | |
DeleteOperation<R> |
SQL delete operation for row of type R.
|
HashMapSelectOperation<K,R> | |
InsertOperation<R> |
SQL insert operation for row of type R.
|
LinkedHashMapSelectOperation<K,R> | |
ListSelectOperation<R> | |
MapSelectOperation<K,R> | |
ModifyOperation<R> |
Base class for operations that modify database.
|
SaveOperation<R> |
SQL update or insert operation for row of type R.
|
ScalarSelectOperation<R> |
Select operation that reads one value at a time.
|
SelectIterator<R> |
Iterator for a
ScalarSelectOperation . |
SelectOperation<R,C> |
SQL select operation returning a collection of rows.
|
SqlOperation<R> |
Base class for all database operations.
|
UpdateOperation<R> |
SQL update operation for row of type R.
|
Exception | Description |
---|---|
BatchException |
Used for one of several error conditions that can occur when
ModifyOperation.setBatch(boolean) is set to true. |
MissingFieldException |
Indicates a field name was not found in a class.
|
OperationException |
Exception that originates in the operation package.
|
ReadOnlyException |
Indicates an insert, update, or delete was attempted for a table that is
read only.
|
There are two types of operations: select operations and modify operations.
All select operations are derived from
SelectOperation
. Insert, save, update, and, delete
operations are derived from ModifyOperation
.
Use operation classes instead of Table
methods if you
need to perform the same operation many times but only want to prepare it once
for efficiency.
For example, select all students by type 3 and then by type 4 with the same operation. "byType" is name of Where annotation on Student:
To update rows (insert, save, and delete are similar):Database database = ... Table<Student> table = database.getTable(Student.class); ArrayListSelectOperation<Student> op = new ArrayListSelectOperation<>(table, "byType"); op.setParameters(3); op.execute(); // JDBC prepare occurs here List<Student> selectedList3 = op.readAll(); op.setParameters(4); op.execute(); // no prepare needed List<Student> selectedList4 = op.readAll(); op.close();
Database database = ... Table<Student> table = database.getTable(Student.class); UpdateOperation<Student> op = new UpdateOperation<>(table); List<Student> list1 = ...; op.setRows(list1); op.execute(); // JDBC prepare occurs here List<Student> list2 = ...; op.setRows(list2); op.execute(); // no prepare needed op.close();