T - type which is accessed by this DAO, for example Item.public interface GenericDAO<T>
| Modifier and Type | Method and Description |
|---|---|
T |
create(Context context,
T t)
Create a new instance of this type in the database.
|
void |
delete(Context context,
T t)
Remove an instance from the database.
|
List<T> |
findAll(Context context,
Class<T> clazz)
Fetch all persisted instances of a given object type.
|
T |
findByID(Context context,
Class clazz,
int id)
Fetch the entity identified by its legacy database identifier.
|
T |
findByID(Context context,
Class clazz,
UUID id)
Fetch the entity identified by its UUID primary key.
|
List<T> |
findMany(Context context,
String query)
Execute a JPQL query and return a collection of results.
|
T |
findUnique(Context context,
String query)
Execute a JPQL query returning a unique result.
|
void |
save(Context context,
T t)
Persist this instance in the database.
|
T create(Context context, T t) throws SQLException
context - current DSpace context.t - type to be created.SQLExceptionvoid save(Context context, T t) throws SQLException
context - current DSpace context.t - type created here.SQLException - passed through.void delete(Context context, T t) throws SQLException
context - current DSpace context.t - type of the instance to be removed.SQLException - passed through.List<T> findAll(Context context, Class<T> clazz) throws SQLException
context - clazz - the desired type.SQLException - if database errorT findUnique(Context context, String query) throws SQLException
context - query - JPQL query stringSQLException - if database errorT findByID(Context context, Class clazz, int id) throws SQLException
context - current DSpace context.clazz - class of entity to be found.id - legacy database record ID.SQLException - passed through.T findByID(Context context, Class clazz, UUID id) throws SQLException
context - current DSpace context.clazz - class of entity to be found.id - primary key of the database record.SQLExceptionList<T> findMany(Context context, String query) throws SQLException
context - query - JPQL query stringSQLException - if database errorCopyright © 2022 LYRASIS. All rights reserved.