public interface Repository extends GeneralDAO
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Object entity)
Deletes an entity instance.
|
<T> void |
deleteById(Class<T> type,
Serializable id)
Deletes an entity instance.
|
void |
evict(Object object)
Remove the provided instance from the session cache.
|
<T> List<T> |
findAll(Class<T> type)
Returns all entities of the persistent type.
|
<T> T |
findById(Class<T> type,
Serializable id,
boolean lock)
Finds an entity by ID.
|
<T> T |
first(Class<T> type,
Query query)
Returns the first result of a query returning instances of a specified
class.
|
Query |
getNamedQuery(String queryName)
Returns a externally defined named query.
|
<T> List<T> |
list(Class<T> type,
Query query)
Returns the results of a query as a list of a specified class.
|
<T> List<T> |
list(Class<T> type,
String queryName,
Object value)
Returns the results of a named query with a single parameter as a list of
a specified class.
|
void |
save(Object entity)
Saves an entity.
|
void |
saveOrUpdate(Object entity)
Saves or updates an entity, depending upon resolution of the
unsaved-value checks.
|
<T> T |
unique(Class<T> type,
Query query)
Returns the unique result of a query returning instances of a specified
class.
|
<T> T |
unique(Class<T> type,
String queryName,
Object value)
Returns the unique result of a named query with a single parameter
returning instances of a specified class.
|
void |
update(Object entity)
Updates an entity.
|
<T> T findById(Class<T> type, Serializable id, boolean lock)
findById in interface GeneralDAOtype - Entity type.id - ID.lock - If the entity shall be locked.null if it is not found.<T> List<T> findAll(Class<T> type)
findAll in interface GeneralDAOtype - Entity type.void save(Object entity)
save in interface GeneralDAOentity - Entity to save.void update(Object entity)
update in interface GeneralDAOentity - Entity to update.void saveOrUpdate(Object entity)
saveOrUpdate in interface GeneralDAOentity - Entity to persist.void delete(Object entity)
delete in interface GeneralDAOentity - Instance to delete.<T> void deleteById(Class<T> type, Serializable id)
deleteById in interface GeneralDAOtype - Entity type.id - Id of the instance to delete.void evict(Object object)
object - The persistent instance to remove.Query getNamedQuery(String queryName)
queryName - Query name.<T> List<T> list(Class<T> type, Query query)
type - Entity type.query - Query to execute.<T> T first(Class<T> type, Query query)
type - Entity type.query - Query to execute.null if there are no results.<T> T unique(Class<T> type, Query query)
type - Entity type.query - Query to execute.null if there are no results.NonUniqueResultException - if there are more than one result.<T> List<T> list(Class<T> type, String queryName, Object value)
type - Entity type.queryName - Query name.value - Non-null parameter value.<T> T unique(Class<T> type, String queryName, Object value)
type - Entity type.queryName - Query name.value - Non-null parameter value.null if there are no results.NonUniqueResultException - if there are more than one result.Copyright © 2014. All rights reserved.