Class HibernatePersistenceService
java.lang.Object
org.bonitasoft.engine.persistence.HibernatePersistenceService
- All Implemented Interfaces:
ReadPersistenceService,PersistenceService
Hibernate implementation of the persistence service
- Author:
- Charles Souillard, Nicolas Chabanoles, Yanyan Liu, Matthieu Chaffotte, Celine Souchet, Laurent Vaills, Guillaume Rosinosky
-
Constructor Summary
ConstructorsConstructorDescriptionHibernatePersistenceService(HibernateConfigurationProvider hbmConfigurationProvider, Properties extraHibernateProperties, SequenceManager sequenceManager, QueryBuilderFactory queryBuilderFactory, HibernateMetricsBinder hibernateMetricsBinder) -
Method Summary
Modifier and TypeMethodDescriptionvoiddelete(long id, Class<? extends PersistentObject> entityClass) Delete a record from the table by id and its class type.voiddelete(List<Long> ids, Class<? extends PersistentObject> entityClass) Delete records from the table.<T extends PersistentObject>
voiddelete(T entity) Delete a record from the table by given PersistentObject.voiddeleteAll(Class<? extends PersistentObject> entityClass) Delete all records belong to the given entity class from the table.voiddeleteAll(Class<? extends PersistentObject> entityClass, List<FilterOption> filters) Delete all elements of a specific tablevoiddestroy()voidprotected org.slf4j.Logger<T extends PersistentObject>
longgetNumberOfEntities(Class<T> entityClass, String querySuffix, QueryOptions options, Map<String, Object> parameters) <T extends PersistentObject>
longgetNumberOfEntities(Class<T> entityClass, QueryOptions options, Map<String, Object> parameters) protected org.hibernate.Session<T extends PersistentObject>
Tinsert(T entity) Add a record into the table by given PersistentObject.<T extends PersistentObject>
List<T>insertInBatch(List<T> entities) <T extends PersistentObject>
List<T>searchEntity(Class<T> entityClass, String querySuffix, QueryOptions options, Map<String, Object> parameters) <T extends PersistentObject>
List<T>searchEntity(Class<T> entityClass, QueryOptions options, Map<String, Object> parameters) <T extends PersistentObject>
TselectById(SelectByIdDescriptor<T> selectDescriptor) <T> List<T>selectList(SelectListDescriptor<T> selectDescriptor) <T> TselectOne(SelectOneDescriptor<T> selectDescriptor) protected voidsetId(PersistentObject entity) intExecutes a query update.intExecutes a query update.voidupdate(UpdateDescriptor updateDescriptor)
-
Constructor Details
-
HibernatePersistenceService
public HibernatePersistenceService(HibernateConfigurationProvider hbmConfigurationProvider, Properties extraHibernateProperties, SequenceManager sequenceManager, QueryBuilderFactory queryBuilderFactory, HibernateMetricsBinder hibernateMetricsBinder)
-
-
Method Details
-
getSession
- Throws:
SPersistenceException
-
flushStatements
- Specified by:
flushStatementsin interfacePersistenceService- Throws:
SPersistenceException
-
delete
Description copied from interface:PersistenceServiceDelete a record from the table by given PersistentObject.- Specified by:
deletein interfacePersistenceService- Throws:
SPersistenceException
-
update
Description copied from interface:PersistenceServiceExecutes a query update.- Specified by:
updatein interfacePersistenceService- 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(String updateQueryName, Map<String, Object> inputParameters) throws SPersistenceExceptionDescription copied from interface:PersistenceServiceExecutes a query update.- Specified by:
updatein interfacePersistenceService- Throws:
SPersistenceException
-
deleteAll
Description copied from interface:PersistenceServiceDelete all records belong to the given entity class from the table.- Specified by:
deleteAllin interfacePersistenceService- Parameters:
entityClass- The class which extends PersistentObject- Throws:
SPersistenceException
-
insert
Description copied from interface:PersistenceServiceAdd a record into the table by given PersistentObject.- Specified by:
insertin interfacePersistenceService- Throws:
SPersistenceException
-
insertInBatch
public <T extends PersistentObject> List<T> insertInBatch(List<T> entities) throws SPersistenceException - Specified by:
insertInBatchin interfacePersistenceService- Throws:
SPersistenceException
-
update
- Specified by:
updatein interfacePersistenceService- Throws:
SPersistenceException
-
selectOne
- Specified by:
selectOnein interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
selectById
public <T extends PersistentObject> T selectById(SelectByIdDescriptor<T> selectDescriptor) throws SBonitaReadException - Specified by:
selectByIdin interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
selectList
- Specified by:
selectListin interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
delete
public void delete(long id, Class<? extends PersistentObject> entityClass) throws SPersistenceException Description copied from interface:PersistenceServiceDelete a record from the table by id and its class type.- Specified by:
deletein interfacePersistenceService- Parameters:
id- entity's identityClass- The class which extends PersistentObject- Throws:
SPersistenceException
-
delete
public void delete(List<Long> ids, Class<? extends PersistentObject> entityClass) throws SPersistenceException Description copied from interface:PersistenceServiceDelete records from the table.- Specified by:
deletein interfacePersistenceService- Parameters:
ids- A list contains entity idsentityClass- The class which extends PersistentObject- Throws:
SPersistenceException
-
destroy
@PreDestroy public void destroy() -
getNumberOfEntities
public <T extends PersistentObject> long getNumberOfEntities(Class<T> entityClass, QueryOptions options, Map<String, Object> parameters) throws SBonitaReadException- Specified by:
getNumberOfEntitiesin interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
getNumberOfEntities
public <T extends PersistentObject> long getNumberOfEntities(Class<T> entityClass, String querySuffix, QueryOptions options, Map<String, Object> parameters) throws SBonitaReadException- Specified by:
getNumberOfEntitiesin interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
searchEntity
public <T extends PersistentObject> List<T> searchEntity(Class<T> entityClass, QueryOptions options, Map<String, Object> parameters) throws SBonitaReadException- Specified by:
searchEntityin interfaceReadPersistenceService- Returns:
- Throws:
SBonitaReadException
-
searchEntity
public <T extends PersistentObject> List<T> searchEntity(Class<T> entityClass, String querySuffix, QueryOptions options, Map<String, Object> parameters) throws SBonitaReadException- Specified by:
searchEntityin interfaceReadPersistenceService- Parameters:
entityClass- class of the object we want to search onquerySuffix- Used to define customized search queryoptions- query options- Returns:
- Throws:
SBonitaReadException
-
setId
- Throws:
SPersistenceException
-
getLogger
protected org.slf4j.Logger getLogger() -
deleteAll
public void deleteAll(Class<? extends PersistentObject> entityClass, List<FilterOption> filters) throws SPersistenceException Description copied from interface:PersistenceServiceDelete all elements of a specific table- Specified by:
deleteAllin interfacePersistenceService- Parameters:
entityClass- Entity class corresponding to the table to emptyfilters- filter options to restrict the deletion- Throws:
SPersistenceException
-