T - Type of handled objectPK - The primary key of the objectpublic interface GenericDAO<T,PK extends Serializable>
Title: GenericDAO
Description: Generic DAO (Data Access Object) containing common methods for object persistence.
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears session.
|
void |
evict(T object)
Evicts given object from session.
|
boolean |
exists(PK id)
Checks for existence of an object with given key.
|
void |
flush()
Flushes session.
|
Collection<T> |
get(Collection<PK> ids)
Generic method to get objects based on class and identifiers.
|
T |
get(PK id)
Generic method to get an object based on class and identifier.
|
List<T> |
getAll()
Generic method used to get all objects of a particular type.
|
List<T> |
getByExample(T object)
Gets objects from the database that match given example.
|
T |
getByUniqueExample(T object)
Gets object from the database that match given example.
|
PK |
getKey(T object)
Generic method to get the identifier of a given object.
|
T |
getLast()
Generic method to get the last object.
|
PK |
getNextPK(PK id)
Get primary key larger than given one
|
PK |
getPreviousPK(PK id)
Get primary key smaller than given one
|
void |
remove(Collection<T> objects)
Generic method to delete a given object
|
void |
remove(PK id)
Generic method to delete an object with given id
|
void |
remove(T object)
Generic method to delete a given object
|
<C extends Collection<T>> |
save(C objects)
Generic method to save collection of objects - handles insert, update and
remove.
|
T |
save(T object)
Generic method to save an object - handles insert, update and remove.
|
void |
setKey(T object,
PK key)
Generic method to set the identifier for a given object.
|
List<T> getAll()
Exception - When database problems occurT get(PK id)
id - The identifier (primary key) of the object to getException - When database problems occurCollection<T> get(Collection<PK> ids)
ids - The identifiers (primary keys) of the objects to getException - When database problems occurT getLast()
PK getNextPK(PK id)
id - PK getPreviousPK(PK id)
id - List<T> getByExample(T object)
object - The template object to match (not null columns)Exception - When database problems occurT getByUniqueExample(T object)
object - The template object to match (not null columns)Exception - When database problems occurboolean exists(PK id)
id - The id of the entityException - When database problems occurT save(T object)
object - The object to saveException - When database problems occur<C extends Collection<T>> C save(C objects)
C - Type of collectionobjects - The objects to saveException - When database problems occurvoid remove(T object)
object - The object to removeException - When database problems occurvoid remove(Collection<T> objects)
object - The object to removeException - When database problems occurvoid remove(PK id)
id - The identifier (primary key) of the object to removeException - When database problems occurvoid flush()
void clear()
void evict(T object)
object - PK getKey(T object)
object - The object to get PK forCopyright © 2014. All Rights Reserved.