Package org.opennms.netmgt.dao.hibernate
Class AbstractDaoHibernate<T,K extends java.io.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 java.io.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(java.lang.Class<T> entityClass)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected <T> org.springframework.orm.hibernate3.HibernateCallback<java.util.List<T>>
buildHibernateCallback(Criteria criteria)
int
bulkDelete(java.lang.String hql, java.lang.Object[] values)
bulkDeletevoid
clear()
int
countAll()
countAllint
countMatching(Criteria criteria)
int
countMatching(OnmsCriteria onmsCrit)
void
delete(K key)
deletevoid
delete(T entity)
deletevoid
deleteAll(java.util.Collection<T> entities)
deleteAlljava.util.List<T>
find(java.lang.String query)
findjava.util.List<T>
find(java.lang.String query, java.lang.Object... values)
findjava.util.List<T>
findAll()
findAlljava.util.List<T>
findMatching(Criteria criteria)
java.util.List<T>
findMatching(OnmsCriteria onmsCrit)
<S> java.util.List<S>
findObjects(java.lang.Class<S> clazz, java.lang.String query, java.lang.Object... values)
findObjectsprotected T
findUnique(java.lang.String queryString, java.lang.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(java.lang.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(java.lang.String query)
queryIntprotected int
queryInt(java.lang.String queryString, java.lang.Object... args)
queryIntK
save(T entity)
savevoid
saveOrUpdate(T entity)
saveOrUpdatevoid
update(T entity)
update
-
-
-
Field Detail
-
m_criteriaConverter
protected final HibernateCriteriaConverter m_criteriaConverter
-
-
Constructor Detail
-
AbstractDaoHibernate
public AbstractDaoHibernate(java.lang.Class<T> entityClass)
-
-
Method Detail
-
initDao
protected void initDao() throws java.lang.Exception
- Overrides:
initDao
in classorg.springframework.dao.support.DaoSupport
- Throws:
java.lang.Exception
-
lock
public void lock()
This is used to lock the table in order to implement upsert type operations
-
initialize
public void initialize(java.lang.Object obj)
- Specified by:
initialize
in interfaceOnmsDao<T,K extends java.io.Serializable>
-
flush
public void flush()
-
clear
public void clear()
-
merge
public void merge(T entity)
-
find
public java.util.List<T> find(java.lang.String query)
find
- Parameters:
query
- aString
object.- Returns:
- a
List
object.
-
find
public java.util.List<T> find(java.lang.String query, java.lang.Object... values)
find
- Parameters:
query
- aString
object.values
- aObject
object.- Returns:
- a
List
object.
-
findObjects
public <S> java.util.List<S> findObjects(java.lang.Class<S> clazz, java.lang.String query, java.lang.Object... values)
findObjects
- Type Parameters:
S
- a S object.- Parameters:
clazz
- aClass
object.query
- aString
object.values
- aObject
object.- Returns:
- a
List
object.
-
queryInt
protected int queryInt(java.lang.String query)
queryInt
- Parameters:
query
- aString
object.- Returns:
- a int.
-
queryInt
protected int queryInt(java.lang.String queryString, java.lang.Object... args)
queryInt
- Parameters:
queryString
- aString
object.args
- aObject
object.- Returns:
- a int.
-
findUnique
protected T findUnique(java.lang.String queryString, java.lang.Object... args)
Return a single instance that matches the query string, or null if the query returns no results.
-
countAll
public int countAll()
countAll
-
delete
public void delete(T entity) throws org.springframework.dao.DataAccessException
delete
-
delete
public void delete(K key) throws org.springframework.dao.DataAccessException
delete
-
deleteAll
public void deleteAll(java.util.Collection<T> entities) throws org.springframework.dao.DataAccessException
deleteAll
- Parameters:
entities
- aCollection
object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
findAll
public java.util.List<T> findAll() throws org.springframework.dao.DataAccessException
findAll
-
findMatching
public java.util.List<T> findMatching(Criteria criteria)
- Specified by:
findMatching
in interfaceOnmsDao<T,K extends java.io.Serializable>
-
buildHibernateCallback
protected <T> org.springframework.orm.hibernate3.HibernateCallback<java.util.List<T>> buildHibernateCallback(Criteria criteria)
-
countMatching
public int countMatching(Criteria criteria) throws org.springframework.dao.DataAccessException
- Specified by:
countMatching
in interfaceOnmsDao<T,K extends java.io.Serializable>
- Throws:
org.springframework.dao.DataAccessException
-
findMatching
public java.util.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(java.lang.String hql, java.lang.Object[] values) throws org.springframework.dao.DataAccessException
bulkDelete
- Parameters:
hql
- aString
object.values
- an array ofObject
objects.- Returns:
- a int.
- 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 java.io.Serializable>
- Parameters:
entity
- a T object.- Throws:
org.springframework.dao.DataAccessException
- if any.
-
-