public abstract class AbstractDAOImpl extends Object implements DAO
| Constructor and Description |
|---|
AbstractDAOImpl()
Constructs the DAO
|
AbstractDAOImpl(org.hibernate.SessionFactory sessionFactory)
Constructs the DAO
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clears the session cache.
|
protected void |
evict(Object object)
Remove the provided instance from the session cache.
|
protected <T> T |
first(Class<T> type,
org.hibernate.Query query)
Returns the first result of a query returning instances of a specified
class.
|
void |
flush()
Flushes the session.
|
protected org.hibernate.Query |
getNamedQuery(String queryName)
Returns a externally defined named query.
|
protected org.hibernate.Session |
getSession()
Returns the current session.
|
protected <T> List<T> |
list(Class<T> type,
org.hibernate.Query query)
Returns the results of a query as a list of a specified class.
|
protected <T> List<T> |
list(Class<T> type,
String queryName,
Object value)
Returns the results of a named query with a single parameter as a list of a specified class.
|
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory)
Sets the session factory to use.
|
void |
sync()
Flushes the session and clears the session cache.
|
protected <T> T |
unique(Class<T> type,
org.hibernate.Query query)
Returns the unique result of a query returning instances of a specified
class.
|
protected <T> T |
unique(Class<T> type,
String queryName,
Object value)
Returns the unique result of a named query with a single parameter returning instances of a specified
class.
|
public AbstractDAOImpl(org.hibernate.SessionFactory sessionFactory)
sessionFactory - Hibernate Session factory.public AbstractDAOImpl()
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
sessionFactory - Hibernate session factory.protected final org.hibernate.Session getSession()
public void clear()
DAOpublic void flush()
DAOpublic void sync()
DAOprotected void evict(Object object)
object - The persistent instance to remove.protected org.hibernate.Query getNamedQuery(String queryName)
queryName - Query name.protected <T> List<T> list(Class<T> type, org.hibernate.Query query)
type - Entity type.query - Query to execute.protected <T> T first(Class<T> type, org.hibernate.Query query)
type - Entity type.query - Query to execute.null if there are no results.protected <T> T unique(Class<T> type, org.hibernate.Query query)
type - Entity type.query - Query to execute.null if there are no results.org.hibernate.NonUniqueResultException - if there are more than one result.protected <T> List<T> list(Class<T> type, String queryName, Object value)
type - Entity type.queryName - Query name.value - Non-null parameter value.protected <T> T unique(Class<T> type, String queryName, Object value)
type - Entity type.queryName - Query name.value - Non-null parameter value.null if there are no results.org.hibernate.NonUniqueResultException - if there are more than one result.Copyright © 2014. All rights reserved.