public interface CommonDao<T>
Modifier and Type | Field and Description |
---|---|
static java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> |
FieldTypes
Drops a single table.
|
Modifier and Type | Method and Description |
---|---|
int |
delete(java.util.List<QueryTerm> terms) |
int |
delete(QueryInstance qi) |
int |
delete(QueryTerm term) |
int |
deleteById(int dbid) |
boolean |
exists(java.util.List<QueryTerm> terms) |
boolean |
exists(QueryTerm term)
Determines whether one or more rows exist matching all of the specified fields with exact values.
|
java.util.List<java.lang.Integer> |
findAllIds(java.util.List<QueryTerm> terms)
Returns the list of row IDs matching all of the specified fields with exact values.
|
java.util.List<java.lang.Integer> |
findAllIds(QueryInstance qi) |
java.util.List<java.lang.Integer> |
findAllIds(QueryTerm term) |
java.util.List<T> |
findAllObjects()
Returns the list of domain objects from all rows in the table.
|
java.util.List<T> |
findAllObjects(java.util.List<QueryTerm> terms)
Returns the list of domain objects matching all of the specified fields with exact values.
|
java.util.List<T> |
findAllObjects(QueryInstance qi) |
java.util.List<T> |
findAllObjects(QueryTerm term) |
T |
findById(int dbId)
Returns the domain object for the specified internal database ID.
|
int |
findId(java.util.List<QueryTerm> terms) |
int |
findId(QueryTerm term)
Returns the first IDs matching all of the specified fields with exact values.
|
java.util.List<T> |
findMultipleObjects(java.util.List<QueryTerm> terms,
int limit) |
java.util.List<T> |
findMultipleObjects(java.util.List<QueryTerm> terms,
int start,
int limit) |
T |
findObject(java.util.List<QueryTerm> terms)
Returns the object matching all of the specified fields with exact values.
|
T |
findObject(QueryInstance qi)
Returns the object matching the specified query.
|
T |
findObject(QueryTerm term)
Returns the object matching the specified query term.
|
int |
getCount(java.util.List<QueryTerm> terms) |
int |
getCount(QueryInstance qi) |
int |
getCount(QueryTerm term)
Returns the number of rows matching all of the specified fields with exact values.
|
default java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> |
getFieldDefns() |
int |
persist(T obj)
Inserts a row in the current table.
|
void |
update(int dbId,
java.util.List<NVPair> values)
Updates a row in the current table
|
void |
update(int dbId,
NVPair value) |
void |
update(int dbId,
T obj)
Updates a row in the current table.
|
static final java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> FieldTypes
int persist(T obj) throws java.lang.IllegalArgumentException
obj
- The object forming the basis of the new row.java.lang.IllegalArgumentException
- If the number of values does not
match exactly the number of columns in the table, less the
primary key field (if applicable).void update(int dbId, java.util.List<NVPair> values) throws NotFoundException
dbId
- The internal database ID for the row to modify.values
- A list of Pairs containing the field names (from the enum element
defined in the concrete class) and values to change.NotFoundException
- If no such row existsvoid update(int dbId, NVPair value) throws NotFoundException
NotFoundException
void update(int dbId, T obj) throws NotFoundException
dbId
- The internal database ID for the row to modify. A caller should be able to
obtain this value by getting it directly from the obj.obj
- Source object for updating the table row's fields.NotFoundException
- If no such row existsT findById(int dbId) throws NotFoundException
dbId
- Internal database ID for the row to return.NotFoundException
- If no such row existsint findId(QueryTerm term) throws NotFoundException
field1 = value1 AND field2 = value2 AND ...
values
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.NotFoundException
- If no such row existsint findId(java.util.List<QueryTerm> terms) throws NotFoundException
NotFoundException
java.util.List<java.lang.Integer> findAllIds(java.util.List<QueryTerm> terms)
terms
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.NotFoundException
- If no rows existjava.util.List<java.lang.Integer> findAllIds(QueryTerm term)
java.util.List<java.lang.Integer> findAllIds(QueryInstance qi)
T findObject(java.util.List<QueryTerm> terms) throws NotFoundException, TooManyTooLargeException
terms
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.NotFoundException
- If no such row existsTooManyTooLargeException
- If more than one row is foundT findObject(QueryTerm term) throws NotFoundException, TooManyTooLargeException
term
- A single termNotFoundException
- If no such row existsTooManyTooLargeException
- If more than one row is foundT findObject(QueryInstance qi) throws NotFoundException, TooManyTooLargeException
qi
- A QueryInstance derived from a QueryBuilder
NotFoundException
- If no such row existsTooManyTooLargeException
- If more than one row is foundjava.util.List<T> findAllObjects() throws NotFoundException
Note: Use with caution. findAllObjects() is intentende for use on tables containing a modest number of rows.
NotFoundException
- If no rows existjava.util.List<T> findAllObjects(java.util.List<QueryTerm> terms) throws NotFoundException
terms
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.NotFoundException
- If no rows existjava.util.List<T> findAllObjects(QueryTerm term) throws NotFoundException
NotFoundException
java.util.List<T> findAllObjects(QueryInstance qi) throws NotFoundException
NotFoundException
java.util.List<T> findMultipleObjects(java.util.List<QueryTerm> terms, int limit) throws NotFoundException
NotFoundException
java.util.List<T> findMultipleObjects(java.util.List<QueryTerm> terms, int start, int limit)
boolean exists(QueryTerm term)
values
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.boolean exists(java.util.List<QueryTerm> terms)
int getCount(QueryTerm term)
values
- A list of Pairs containing field names (as the enum element
defined in the concrete class) and values to search on.int getCount(java.util.List<QueryTerm> terms)
int getCount(QueryInstance qi)
int deleteById(int dbid)
int delete(QueryTerm term)
int delete(java.util.List<QueryTerm> terms)
int delete(QueryInstance qi)
default java.util.List<Pair<java.lang.Enum<?>,java.lang.String>> getFieldDefns()