uk.ac.soton.itinnovation.grid.service.sla.dao
Class GenericHibernateDAO<T,ID extends Serializable>

java.lang.Object
  extended by uk.ac.soton.itinnovation.grid.service.sla.dao.GenericHibernateDAO<T,ID>
All Implemented Interfaces:
GenericDAO<T,ID>
Direct Known Subclasses:
ActivityDAOImpl, ResourcePoolDAOImpl, ResourceWithUsageByMetricDAOImpl, SlaDAOImpl, SLATemplateDAOImpl, UsageSummaryDAOImpl, UsageSummaryElementDAOImpl

public abstract class GenericHibernateDAO<T,ID extends Serializable>
extends Object
implements GenericDAO<T,ID>


Constructor Summary
GenericHibernateDAO()
           
 
Method Summary
 void delete(T entity)
          Delete an entity.
 List<T> findAll()
          Find all entities
protected  List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)
           
 T findById(ID id)
          Find the entity identified by id
 T findById(ID id, boolean lock)
          Find the entity identified by id and optionally acquire a pessimistic lock on the entity.
 Class<T> getPersistentClass()
           
 void saveOrUpdate(T entity)
          Save or update entity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GenericHibernateDAO

public GenericHibernateDAO()
Method Detail

getPersistentClass

public Class<T> getPersistentClass()

findById

public T findById(ID id)
Description copied from interface: GenericDAO
Find the entity identified by id

Specified by:
findById in interface GenericDAO<T,ID extends Serializable>
Parameters:
id - the identity property of the entity
Returns:
the entity or null

findById

public T findById(ID id,
                  boolean lock)
Description copied from interface: GenericDAO
Find the entity identified by id and optionally acquire a pessimistic lock on the entity.

Specified by:
findById in interface GenericDAO<T,ID extends Serializable>
Parameters:
id - the unique id for the entity
lock - whether or not to obtain a pessimistic lock
Returns:
the entity or null if it does not exist

findAll

public List<T> findAll()
Description copied from interface: GenericDAO
Find all entities

Specified by:
findAll in interface GenericDAO<T,ID extends Serializable>
Returns:
List of all entities

saveOrUpdate

public void saveOrUpdate(T entity)
Description copied from interface: GenericDAO
Save or update entity

Specified by:
saveOrUpdate in interface GenericDAO<T,ID extends Serializable>
Parameters:
entity - the entity to save or update

delete

public void delete(T entity)
Description copied from interface: GenericDAO
Delete an entity. The entity is passes as a parameter (rather than the id of the entity) because the hibernate delete API is like this.

Specified by:
delete in interface GenericDAO<T,ID extends Serializable>
Parameters:
entity - the entity to delete

findByCriteria

protected List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)


Copyright © 2001-2007 University of Southampton IT Innovation Centre. All Rights Reserved.