public abstract class HibernateDao<T> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
HibernateDao() |
| Modifier and Type | Method and Description |
|---|---|
protected org.hibernate.Session |
currentSession() |
protected abstract Class<T> |
getPersistentClass()
All subclasses of HibernateDAO must implement this method for
load(long) to
work correctly |
T |
load(long ID)
Loads a persistence DAO object from the persistence store.
|
void |
remove(T persistentObject)
Removes the DAO object from the persistence store.
|
protected void |
save(T persistentObject)
Saves a new DAO object to the persistence store.
|
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory) |
void |
update(T persistentObject)
Updates an existing DAO object, if the object does not exist it will be added to the persistence store.
|
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
protected org.hibernate.Session currentSession()
protected void save(T persistentObject) throws org.springframework.dao.DataAccessException
persistentObject - The object to save.org.springframework.dao.DataAccessException - A persistence exception has occurred.public void update(T persistentObject) throws org.springframework.dao.DataAccessException
persistentObject - The object to update.org.springframework.dao.DataAccessException - A persistence exception has occurred.public void remove(T persistentObject) throws org.springframework.dao.DataAccessException
persistentObject - The object to remove.org.springframework.dao.DataAccessException - A persistence exception has occurred.public T load(long ID) throws ObjectNotFoundException
ID - The unique identifier of the object to load from the persistence store.ObjectNotFoundExceptionprotected abstract Class<T> getPersistentClass()
load(long) to
work correctlyCopyright © 2016 Atlassian. All rights reserved.