Package dk.netarkivet.wayback.indexer
Class GenericHibernateDAO<T,PK extends Serializable>
- java.lang.Object
-
- dk.netarkivet.wayback.indexer.GenericHibernateDAO<T,PK>
-
- Type Parameters:
T
- The type of the persistent entity.PK
- The type of the primary key for the entity.
- All Implemented Interfaces:
GenericDAO<T,PK>
- Direct Known Subclasses:
ArchiveFileDAO
public class GenericHibernateDAO<T,PK extends Serializable> extends Object implements GenericDAO<T,PK>
An implementation of Generic DAO which is specialised for hibernate object stores.
-
-
Constructor Summary
Constructors Constructor Description GenericHibernateDAO(Class<T> type)
Constructor for the class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
create
public PK create(T o)
Description copied from interface:GenericDAO
Persist the newInstance object into database.- Specified by:
create
in interfaceGenericDAO<T,PK extends Serializable>
- Parameters:
o
- the object to persist.- Returns:
- the key assigned to the object.
-
read
public T read(PK id)
Description copied from interface:GenericDAO
Retrieve an object that was previously persisted to the database using the indicated id as primary key.- Specified by:
read
in interfaceGenericDAO<T,PK extends Serializable>
- Parameters:
id
- the key of the object to be retrieved.- Returns:
- the retrieved object.
-
update
public void update(T o)
Description copied from interface:GenericDAO
Save changes made to a persistent object.- Specified by:
update
in interfaceGenericDAO<T,PK extends Serializable>
- Parameters:
o
- the object to be updated.
-
delete
public void delete(T o)
Description copied from interface:GenericDAO
Remove an object from persistent storage in the database.- Specified by:
delete
in interfaceGenericDAO<T,PK extends Serializable>
- Parameters:
o
- the object to be deleted.
-
getSession
protected org.hibernate.Session getSession()
Return a session object for managing instances of this class.- Returns:
- the session.
-
-