Class AbstractHibernatePersistenceService
- java.lang.Object
-
- org.bonitasoft.engine.persistence.AbstractDBPersistenceService
-
- org.bonitasoft.engine.persistence.AbstractHibernatePersistenceService
-
- All Implemented Interfaces:
ReadPersistenceService,PersistenceService,TenantPersistenceService
- Direct Known Subclasses:
PlatformHibernatePersistenceService,TenantHibernatePersistenceService
public abstract class AbstractHibernatePersistenceService extends AbstractDBPersistenceService
Hibernate implementation of the persistence service- Author:
- Charles Souillard, Nicolas Chabanoles, Yanyan Liu, Matthieu Chaffotte, Celine Souchet, Laurent Vaills, Guillaume Rosinosky
-
-
Field Summary
-
Fields inherited from class org.bonitasoft.engine.persistence.AbstractDBPersistenceService
datasource
-
-
Constructor Summary
Constructors Modifier Constructor Description AbstractHibernatePersistenceService(java.lang.String name, HibernateConfigurationProvider hbmConfigurationProvider, java.util.Properties extraHibernateProperties, SequenceManager sequenceManager, javax.sql.DataSource datasource, QueryBuilderFactory queryBuilderFactory)protectedAbstractHibernatePersistenceService(org.hibernate.SessionFactory sessionFactory, java.util.List<java.lang.Class<? extends PersistentObject>> classMapping, java.util.Map<java.lang.String,java.lang.String> classAliasMappings, boolean enableWordSearch, java.util.Set<java.lang.String> wordSearchExclusionMappings)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete(long id, java.lang.Class<? extends PersistentObject> entityClass)Delete a record from the table by id and its class type.voiddelete(java.util.List<java.lang.Long> ids, java.lang.Class<? extends PersistentObject> entityClass)Delete records from the table.voiddelete(PersistentObject entity)Delete a record from the table by given persistentObject.voiddeleteAll(java.lang.Class<? extends PersistentObject> entityClass)Delete all records belong to the given entity class from the table.voiddestroy()java.util.Map<java.lang.String,java.lang.String>getClassAliasMappings()protected org.hibernate.SessiongetSession(boolean useTenant)org.hibernate.SessionFactorygetSessionFactory()voidinsert(PersistentObject entity)Add a record into the table by given persistentObject.voidinsertInBatch(java.util.List<? extends PersistentObject> entities)<T extends PersistentObject>
TselectById(SelectByIdDescriptor<T> selectDescriptor)<T> java.util.List<T>selectList(SelectListDescriptor<T> selectDescriptor)<T> TselectOne(SelectOneDescriptor<T> selectDescriptor)protected voidsetId(PersistentObject entity)intupdate(java.lang.String updateQueryName)Executes a query update.intupdate(java.lang.String updateQueryName, java.util.Map<java.lang.String,java.lang.Object> inputParameters)Executes a query update.voidupdate(UpdateDescriptor updateDescriptor)-
Methods inherited from class org.bonitasoft.engine.persistence.AbstractDBPersistenceService
getLogger, getName, getNumberOfEntities, getNumberOfEntities, getSequenceManager, getTenantId, searchEntity, searchEntity
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.bonitasoft.engine.services.PersistenceService
deleteByTenant, flushStatements
-
-
-
-
Constructor Detail
-
AbstractHibernatePersistenceService
protected AbstractHibernatePersistenceService(org.hibernate.SessionFactory sessionFactory, java.util.List<java.lang.Class<? extends PersistentObject>> classMapping, java.util.Map<java.lang.String,java.lang.String> classAliasMappings, boolean enableWordSearch, java.util.Set<java.lang.String> wordSearchExclusionMappings) throws java.lang.Exception- Throws:
java.lang.Exception
-
AbstractHibernatePersistenceService
public AbstractHibernatePersistenceService(java.lang.String name, HibernateConfigurationProvider hbmConfigurationProvider, java.util.Properties extraHibernateProperties, SequenceManager sequenceManager, javax.sql.DataSource datasource, QueryBuilderFactory queryBuilderFactory) throws java.lang.Exception- Throws:
java.lang.Exception
-
-
Method Detail
-
getSession
protected org.hibernate.Session getSession(boolean useTenant) throws SPersistenceException- Throws:
SPersistenceException
-
delete
public void delete(PersistentObject entity) throws SPersistenceException
Description copied from interface:PersistenceServiceDelete a record from the table by given persistentObject.- Throws:
SPersistenceException
-
update
public int update(java.lang.String updateQueryName) throws SPersistenceExceptionDescription copied from interface:PersistenceServiceExecutes a query update.- Parameters:
updateQueryName- the name of the declared query that represent the update.- Returns:
- the number of updated rows, as returned by the underlining persistence implementation.
- Throws:
SPersistenceException- if a persistence problem occurs when executing the update query.
-
update
public int update(java.lang.String updateQueryName, java.util.Map<java.lang.String,java.lang.Object> inputParameters) throws SPersistenceExceptionDescription copied from interface:PersistenceServiceExecutes a query update.- Returns:
- Throws:
SPersistenceException
-
deleteAll
public void deleteAll(java.lang.Class<? extends PersistentObject> entityClass) throws SPersistenceException
Description copied from interface:PersistenceServiceDelete all records belong to the given entity class from the table.- Parameters:
entityClass- The class which extends persistentObject- Throws:
SPersistenceException
-
insert
public void insert(PersistentObject entity) throws SPersistenceException
Description copied from interface:PersistenceServiceAdd a record into the table by given persistentObject.- Throws:
SPersistenceException
-
insertInBatch
public void insertInBatch(java.util.List<? extends PersistentObject> entities) throws SPersistenceException
- Throws:
SPersistenceException
-
update
public void update(UpdateDescriptor updateDescriptor) throws SPersistenceException
- Throws:
SPersistenceException
-
selectOne
public <T> T selectOne(SelectOneDescriptor<T> selectDescriptor) throws SBonitaReadException
- Returns:
- Throws:
SBonitaReadException
-
selectById
public <T extends PersistentObject> T selectById(SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException
- Returns:
- Throws:
SBonitaReadException
-
setId
protected void setId(PersistentObject entity) throws SPersistenceException
- Overrides:
setIdin classAbstractDBPersistenceService- Throws:
SPersistenceException
-
selectList
public <T> java.util.List<T> selectList(SelectListDescriptor<T> selectDescriptor) throws SBonitaReadException
- Returns:
- Throws:
SBonitaReadException
-
getClassAliasMappings
public java.util.Map<java.lang.String,java.lang.String> getClassAliasMappings()
-
delete
public void delete(long id, java.lang.Class<? extends PersistentObject> entityClass) throws SPersistenceExceptionDescription copied from interface:PersistenceServiceDelete a record from the table by id and its class type.- Parameters:
id- entity's identityClass- The class which extends persistentObject- Throws:
SPersistenceException
-
delete
public void delete(java.util.List<java.lang.Long> ids, java.lang.Class<? extends PersistentObject> entityClass) throws SPersistenceExceptionDescription copied from interface:PersistenceServiceDelete records from the table.- Parameters:
ids- A list contains entity idsentityClass- The class which extends persistentObject- Throws:
SPersistenceException
-
destroy
public void destroy()
-
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory()
-
-