T - the type of the entity objectPK - the type of the primary key from the entity objectpublic interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable> extends Serializable
GenericRepository provide an API for database operations like insert,
delete, update and selections.| Modifier and Type | Method and Description |
|---|---|
void |
create(T entity)
Persists the given entity.
|
void |
delete(List<T> objects)
Delete all persistent objects in the given list.
|
void |
delete(PK id)
Deletes an object of a given Id.
|
void |
delete(T object)
Deletes the given object from persistent storage in the database.
|
void |
evict(T object)
Remove this instance from the session cache.
|
boolean |
exists(PK id)
Checks if an entry exists with the given id.
|
List<T> |
findAll()
Returns a list of all persistent objects.
|
T |
get(PK id)
Retrieve a persisted object with a given id from the database.
|
EntityManager |
getEntityManager()
Gets the entity manager.
|
Query |
getQuery(String hqlQuery)
Gets a
Query from the given hql query. |
Class<T> |
getType()
Gets the class type.
|
T |
load(PK id)
Retrieve a persisted object with a given id from the database.
|
List<T> |
merge(List<T> objects)
Merges all new objects in the given list.
|
T |
merge(T object)
Merges the given object.
|
void |
refresh(T object)
Re-read the state of the given instance from the underlying database.
|
List<PK> |
save(List<T> objects)
Save all new objects in the given list.
|
PK |
save(T object)
Persist the given object into database.
|
void |
saveOrUpdate(List<T> objects)
Save or update all transient objects in the given list.
|
void |
saveOrUpdate(T object)
Save or update the given persistent object.
|
void |
setEntityManager(EntityManager entityManager)
Sets the entity manager.
|
void |
update(List<T> objects)
Update all transient objects in the given list.
|
void |
update(T object)
Update changes made to the given object.
|
void create(T entity)
entity - the entityvoid delete(List<T> objects)
objects - the list with the persistent objects to deletevoid delete(PK id)
id - the idvoid delete(T object)
object - the persistent objectvoid evict(T object)
object - the object to evict.boolean exists(PK id)
id - the id to checkList<T> findAll()
T get(PK id)
id - the idEntityManager getEntityManager()
Query getQuery(String hqlQuery)
Query from the given hql query.hqlQuery - the hql queryQueryT load(PK id)
id - the idList<T> merge(List<T> objects)
objects - the list to saveT merge(T object)
object - the objectvoid refresh(T object)
object - the object to re-read.List<PK> save(List<T> objects)
objects - the list to savePK save(T object)
object - the new instance to save.void saveOrUpdate(List<T> objects)
objects - the transient objectsvoid saveOrUpdate(T object)
object - the transient object to save or update.void setEntityManager(EntityManager entityManager)
entityManager - the new entity managervoid update(List<T> objects)
objects - the transient objects to update.void update(T object)
object - the transient object to update.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.