T - the type of the entity objectPK - the type of the primary key from the entity objectpublic abstract class AbstractRepository<T extends BaseEntity<PK>,PK extends Serializable> extends Object implements GenericRepository<T,PK>
AbstractRepository provides methods for database operations like insert,
delete, update and selections.| Constructor and Description |
|---|
AbstractRepository() |
| 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 entity)
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.
|
Query |
getQuery(String hqlQuery)
Gets a
Query from the given hql query. |
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 |
update(List<T> objects)
Update all transient objects in the given list.
|
void |
update(T entity)
Update changes made to the given object.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetEntityManager, getType, setEntityManagerpublic void create(T entity)
create in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>entity - the entitypublic void delete(List<T> objects)
delete in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>objects - the list with the persistent objects to deletepublic void delete(PK id)
delete in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>id - the idpublic void delete(T entity)
delete in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>entity - the persistent objectpublic void evict(T object)
evict in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>object - the object to evict.public boolean exists(PK id)
exists in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>id - the id to checkpublic List<T> findAll()
findAll in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>public T get(PK id)
get in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>id - the idpublic Query getQuery(String hqlQuery)
Query from the given hql query.getQuery in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>hqlQuery - the hql queryQuerypublic T load(PK id)
load in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>id - the idpublic List<T> merge(List<T> objects)
merge in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>objects - the list to savepublic T merge(T object)
merge in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>object - the objectpublic void refresh(T object)
GenericRepositoryrefresh in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>object - the object to re-read.public List<PK> save(List<T> objects)
save in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>objects - the list to savepublic PK save(T object)
save in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>object - the new instance to save.public void saveOrUpdate(List<T> objects)
saveOrUpdate in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>objects - the transient objectspublic void saveOrUpdate(T object)
saveOrUpdate in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>object - the transient object to save or update.public void update(List<T> objects)
update in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>objects - the transient objects to update.public void update(T entity)
update in interface GenericRepository<T extends BaseEntity<PK>,PK extends Serializable>entity - the transient object to update.Copyright © 2015–2017 Alpha Ro Group UG (haftungsbeschrÀngt). All rights reserved.