T
- The type of the persistent entity.PK
- The type of the primary key for the entity.public class GenericHibernateDAO<T,PK extends Serializable> extends Object implements GenericDAO<T,PK>
Constructor and Description |
---|
GenericHibernateDAO(Class<T> type)
Constructor for the class.
|
Modifier and Type | Method and Description |
---|---|
PK |
create(T o)
Persist the newInstance object into database.
|
void |
delete(T o)
Remove an object from persistent storage in the database.
|
protected List<T> |
findByCriteria(org.hibernate.criterion.Criterion... criterion)
Use this inside subclasses as a convenience method to find objects matching a given criterion.
|
protected org.hibernate.Session |
getSession()
Return a session object for managing instances of this class.
|
T |
read(PK id)
Retrieve an object that was previously persisted to the database using the indicated id as primary key.
|
void |
update(T o)
Save changes made to a persistent object.
|
public GenericHibernateDAO(Class<T> type)
type
- the type of the persistent entity managed by this class.public PK create(T o)
GenericDAO
create
in interface GenericDAO<T,PK extends Serializable>
o
- the object to persist.public T read(PK id)
GenericDAO
read
in interface GenericDAO<T,PK extends Serializable>
id
- the key of the object to be retrieved.public void update(T o)
GenericDAO
update
in interface GenericDAO<T,PK extends Serializable>
o
- the object to be updated.public void delete(T o)
GenericDAO
delete
in interface GenericDAO<T,PK extends Serializable>
o
- the object to be deleted.protected org.hibernate.Session getSession()
protected List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)
criterion
- the criteria to be matched.Copyright © 2005–2016 The Royal Danish Library, the Danish State and University Library, the National Library of France and the Austrian National Library.. All rights reserved.