Package org.opennms.netmgt.dao.hibernate
Class AbstractDaoHibernate<T,K extends Serializable>
- java.lang.Object
-
- org.springframework.dao.support.DaoSupport
-
- org.springframework.orm.hibernate3.support.HibernateDaoSupport
-
- org.opennms.netmgt.dao.hibernate.AbstractDaoHibernate<T,K>
-
- All Implemented Interfaces:
OnmsDao<T,K>
,org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
AbstractCachingDaoHibernate
,AcknowledgmentDaoHibernate
,AlarmAssociationDaoHibernate
,AlarmDaoHibernate
,ApplicationDaoHibernate
,AssetRecordDaoHibernate
,BmpAsnInfoDaoImpl
,BmpAsnPathAnalysisDaoImpl
,BmpBaseAttributeDaoImpl
,BmpCollectorDaoImpl
,BmpGlobalIpRibDaoImpl
,BmpIpRibLogDaoImpl
,BmpPeerDaoImpl
,BmpRouteInfoDaoImpl
,BmpRouterDaoImpl
,BmpRpkiInfoImpl
,BmpStatsByAsnDaoImpl
,BmpStatsByPeerDaoImpl
,BmpStatsByPrefixDaoImpl
,BmpStatsIpOriginsDaoImpl
,BmpStatsPeerRibDaoImpl
,BmpUnicastPrefixDaoImpl
,BridgeBridgeLinkDaoHibernate
,BridgeElementDaoHibernate
,BridgeMacLinkDaoHibernate
,BridgeStpLinkDaoHibernate
,BusinessServiceDaoImpl
,BusinessServiceEdgeDaoImpl
,CdpElementDaoHibernate
,CdpLinkDaoHibernate
,ClassificationGroupDaoImpl
,ClassificationRuleDaoImpl
,DistPollerDaoHibernate
,EventCountDaoHibernate
,EventDaoHibernate
,FilterFavoriteDaoHibernate
,GrafanaEndpointDaoImpl
,HwEntityAttributeTypeDaoHibernate
,HwEntityDaoHibernate
,IpInterfaceDaoHibernate
,IpNetToMediaDaoHibernate
,IsIsElementDaoHibernate
,IsIsLinkDaoHibernate
,LayoutDaoImpl
,LldpElementDaoHibernate
,LldpLinkDaoHibernate
,MapFunctionDaoImpl
,MemoDaoHibernate
,MinionDaoHibernate
,MonitoredServiceDaoHibernate
,MonitoringLocationDaoHibernate
,MonitoringSystemDaoHibernate
,NodeDaoHibernate
,NotificationDaoHibernate
,OspfElementDaoHibernate
,OspfLinkDaoHibernate
,OutageDaoHibernate
,PathOutageDaoHibernate
,ReductionFunctionDaoImpl
,ReportCatalogDaoHibernate
,RequisitionedCategoryAssociationDaoHibernate
,ResourceReferenceDaoHibernate
,SnmpInterfaceDaoHibernate
,StatisticsReportDaoHibernate
,StatisticsReportDataDaoHibernate
,UserDefinedLinkDaoHibernate
,UserNotificationDaoHibernate
public abstract class AbstractDaoHibernate<T,K extends Serializable> extends org.springframework.orm.hibernate3.support.HibernateDaoSupport implements OnmsDao<T,K>
Abstract AbstractDaoHibernate class.
- Version:
- $Id: $
- Author:
- ranger
-
-
Field Summary
Fields Modifier and Type Field Description protected HibernateCriteriaConverter
m_criteriaConverter
-
Constructor Summary
Constructors Constructor Description AbstractDaoHibernate(Class<T> entityClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> org.springframework.orm.hibernate3.HibernateCallback<List<T>>
buildHibernateCallback(Criteria criteria)
int
bulkDelete(String hql, Object[] values)
bulkDeletevoid
clear()
int
countAll()
countAllint
countMatching(Criteria criteria)
int
countMatching(OnmsCriteria onmsCrit)
void
delete(K key)
deletevoid
delete(T entity)
deletevoid
deleteAll(Collection<T> entities)
deleteAllList<T>
find(String query)
findList<T>
find(String query, Object... values)
findList<T>
findAll()
findAllList<T>
findMatching(Criteria criteria)
List<T>
findMatching(OnmsCriteria onmsCrit)
<S> List<S>
findObjects(Class<S> clazz, String query, Object... values)
findObjectsprotected T
findUnique(String queryString, Object... args)
Return a single instance that matches the query string, or null if the query returns no results.void
flush()
T
get(K id)
getprotected void
initDao()
void
initialize(Object obj)
T
load(K id)
loadvoid
lock()
This is used to lock the table in order to implement upsert type operationsvoid
merge(T entity)
protected int
queryInt(String query)
queryIntprotected int
queryInt(String queryString, Object... args)
queryIntK
save(T entity)
savevoid
saveOrUpdate(T entity)
saveOrUpdatevoid
update(T entity)
update
-
-
-
Field Detail
-
m_criteriaConverter
protected final HibernateCriteriaConverter m_criteriaConverter
-
-
Method Detail
-
initDao
protected void initDao() throws Exception
- Overrides:
initDao
in classorg.springframework.dao.support.DaoSupport
- Throws:
Exception
-
lock
public void lock()
This is used to lock the table in order to implement upsert type operations- Specified by:
lock
in interfaceOnmsDao<T,K extends Serializable>
-
initialize
public void initialize(Object obj)
- Specified by:
initialize
in interfaceOnmsDao<T,K extends Serializable>
-
flush
public void flush()
- Specified by:
flush
in interfaceOnmsDao<T,K extends Serializable>
-
clear
public void clear()
- Specified by:
clear
in interfaceOnmsDao<T,K extends Serializable>
-
merge
public void merge(T entity)
-
findObjects
public <S> List<S> findObjects(Class<S> clazz, String query, Object... values)
findObjects
-
queryInt
protected int queryInt(String query)
queryInt
- Parameters:
query
- aString
object.- Returns:
- a int.
-
findUnique
protected T findUnique(String queryString, Object... args)
Return a single instance that matches the query string, or null if the query returns no results.
-
countAll
public int countAll()
countAll
- Specified by:
countAll
in interfaceOnmsDao<T,K extends Serializable>
- Returns:
- a int.
-
delete
public void delete(T entity) throws org.springframework.dao.DataAccessException
delete
- Specified by:
delete
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
delete
public void delete(K key) throws org.springframework.dao.DataAccessException
delete
- Specified by:
delete
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
key
- a K object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
deleteAll
public void deleteAll(Collection<T> entities) throws org.springframework.dao.DataAccessException
deleteAll
- Parameters:
entities
- aCollection
object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
findMatching
public List<T> findMatching(Criteria criteria)
- Specified by:
findMatching
in interfaceOnmsDao<T,K extends Serializable>
-
buildHibernateCallback
protected <T> org.springframework.orm.hibernate3.HibernateCallback<List<T>> buildHibernateCallback(Criteria criteria)
-
countMatching
public int countMatching(Criteria criteria) throws org.springframework.dao.DataAccessException
- Specified by:
countMatching
in interfaceOnmsDao<T,K extends Serializable>
- Throws:
org.springframework.dao.DataAccessException
-
findMatching
public List<T> findMatching(OnmsCriteria onmsCrit) throws org.springframework.dao.DataAccessException
- Throws:
org.springframework.dao.DataAccessException
-
countMatching
public int countMatching(OnmsCriteria onmsCrit) throws org.springframework.dao.DataAccessException
- Throws:
org.springframework.dao.DataAccessException
-
bulkDelete
public int bulkDelete(String hql, Object[] values) throws org.springframework.dao.DataAccessException
bulkDelete
-
get
public T get(K id) throws org.springframework.dao.DataAccessException
get
- Specified by:
get
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
id
- a K object.- Returns:
- a T object.
- Throws:
org.springframework.dao.DataAccessException
- if any.
-
load
public T load(K id) throws org.springframework.dao.DataAccessException
load
- Specified by:
load
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
id
- a K object.- Returns:
- a T object.
- Throws:
org.springframework.dao.DataAccessException
- if any.
-
save
public K save(T entity) throws org.springframework.dao.DataAccessException
save
- Specified by:
save
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
saveOrUpdate
public void saveOrUpdate(T entity) throws org.springframework.dao.DataAccessException
saveOrUpdate
- Specified by:
saveOrUpdate
in interfaceOnmsDao<T,K extends Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
-