|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.derquinsej.hib3.AbstractDAOImpl
net.sf.derquinsej.hib3.GenericDAOImpl<T,ID>
public abstract class GenericDAOImpl<T,ID extends Serializable>
Implementation of the Generic DAO.
| Constructor Summary | |
|---|---|
GenericDAOImpl()
Constructs the DAO |
|
GenericDAOImpl(Class<T> persistentClass)
Constructs the DAO. |
|
GenericDAOImpl(Class<T> persistentClass,
org.hibernate.SessionFactory sessionFactory)
Constructs the DAO. |
|
GenericDAOImpl(org.hibernate.SessionFactory sessionFactory)
Constructs the DAO |
|
| Method Summary | |
|---|---|
void |
delete(T entity)
Deletes an entity instance. |
void |
deleteById(ID id)
Deletes an entity instance. |
List<T> |
findAll()
Returns all entities of the persistent type. |
protected List<T> |
findByCriteria(org.hibernate.criterion.Criterion... criterion)
Returns the list of entity instances that matches the provided crtieria. |
T |
findById(ID id,
boolean lock)
Finds an entity by ID. |
protected T |
first(org.hibernate.Query query)
Returns the first result of a query returning instances of the persisted class. |
protected Class<T> |
getPersistentClass()
Returns the persistent class. |
protected List<T> |
list(org.hibernate.Query query)
Returns the results of a query as a list of the persisted class. |
protected org.hibernate.Criteria |
newCriteria()
Returns a new criteria object. |
T |
save(T entity)
Saves an entity. |
T |
saveOrUpdate(T entity)
Saves or updates an entity, depending upon resolution of the unsaved-value checks. |
protected T |
unique(org.hibernate.Query query)
Returns the unique result of a query returning instances of the persisted class. |
T |
update(T entity)
Updates an entity. |
| Methods inherited from class net.sf.derquinsej.hib3.AbstractDAOImpl |
|---|
clear, evict, first, flush, getNamedQuery, getSession, list, list, setSessionFactory, sync, unique, unique |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface net.sf.derquinsej.hib3.DAO |
|---|
clear, flush, sync |
| Constructor Detail |
|---|
public GenericDAOImpl(org.hibernate.SessionFactory sessionFactory)
sessionFactory - Hibernate Session factory.
public GenericDAOImpl(Class<T> persistentClass,
org.hibernate.SessionFactory sessionFactory)
persistentClass - Persistent class.sessionFactory - Hibernate Session factory.public GenericDAOImpl()
public GenericDAOImpl(Class<T> persistentClass)
persistentClass - Persistent class.| Method Detail |
|---|
protected final Class<T> getPersistentClass()
public void delete(T entity)
GenericDAO
delete in interface GenericDAO<T,ID extends Serializable>entity - Instance to delete.public void deleteById(ID id)
GenericDAO
deleteById in interface GenericDAO<T,ID extends Serializable>id - Id of the instance to delete.public List<T> findAll()
GenericDAO
findAll in interface GenericDAO<T,ID extends Serializable>
public T findById(ID id,
boolean lock)
GenericDAO
findById in interface GenericDAO<T,ID extends Serializable>id - IDlock - If the entity shall be locked.
null if it is not found.public T save(T entity)
GenericDAO
save in interface GenericDAO<T,ID extends Serializable>entity - Entity to save.
public T saveOrUpdate(T entity)
GenericDAO
saveOrUpdate in interface GenericDAO<T,ID extends Serializable>entity - Entity to persist.
public T update(T entity)
GenericDAO
update in interface GenericDAO<T,ID extends Serializable>entity - Entity to update.
protected final org.hibernate.Criteria newCriteria()
protected final List<T> findByCriteria(org.hibernate.criterion.Criterion... criterion)
criterion - Search criteria.
protected final List<T> list(org.hibernate.Query query)
query - Query to execute.
protected final T first(org.hibernate.Query query)
query - Query to execute.
null if there are no results.protected final T unique(org.hibernate.Query query)
query - Query to execute.
null if there are no results.
org.hibernate.NonUniqueResultException - if there are more than one result.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||