Package com.logicaldoc.core.sequence
Class HibernateSequenceDAO
- java.lang.Object
-
- com.logicaldoc.core.HibernatePersistentObjectDAO<Sequence>
-
- com.logicaldoc.core.sequence.HibernateSequenceDAO
-
- All Implemented Interfaces:
PersistentObjectDAO<Sequence>,SequenceDAO
public class HibernateSequenceDAO extends HibernatePersistentObjectDAO<Sequence> implements SequenceDAO
Hibernate implementation ofSequenceDAO.
Sequences are implemented ad Generics whose type is 'sequence' and subtype is the sequence name.- Since:
- 4.0
- Author:
- Marco Meschieri - LogicalDOC
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleandelete(long id, int code)This method deletes an entity and you can give a deletion codevoiddelete(String name, long objectId, long tenantId)Deletes the sequenceSequencefindByAlternateKey(String name, long objectId, long tenantId)Finds the sequence by the given alternate keyList<Sequence>findByName(String name, long tenantId)Finds all sequences whose name starts with the passed namelonggetCurrentValue(String sequence, long objectId, long tenantId)Gets the current valuelongnext(String sequence, long objectId, long tenantId)Returns the next value of the sequencelongnext(String sequence, long objectId, long tenantId, long increment)Returns the next value of the sequence by incrementing by the given incrementvoidreset(String sequence, long objectId, long tenantId, long value)Initializes the sequence value-
Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, getSessionFactory, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, setSessionFactory, store
-
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.logicaldoc.core.PersistentObjectDAO
bulkUpdate, delete, deleteAll, deleteAll, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDbms, initialize, isOracle, jdbcUpdate, jdbcUpdate, query, queryForInt, queryForList, queryForList, queryForLong, queryForObject, queryForRowSet, queryForString, store
-
-
-
-
Method Detail
-
reset
public void reset(String sequence, long objectId, long tenantId, long value)
Description copied from interface:SequenceDAOInitializes the sequence value- Specified by:
resetin interfaceSequenceDAO- Parameters:
sequence- name of the sequenceobjectId- The sequence object IDtenantId- ID of the owning tenantvalue- The initial value
-
next
public long next(String sequence, long objectId, long tenantId, long increment)
Description copied from interface:SequenceDAOReturns the next value of the sequence by incrementing by the given increment- Specified by:
nextin interfaceSequenceDAO- Parameters:
sequence- name of the sequenceobjectId- The sequence object IDtenantId- ID of the owning tenantincrement- ID of the owning tenant- Returns:
- The next value
-
next
public long next(String sequence, long objectId, long tenantId)
Description copied from interface:SequenceDAOReturns the next value of the sequence- Specified by:
nextin interfaceSequenceDAO- Parameters:
sequence- name of the sequenceobjectId- The sequence object IDtenantId- ID of the owning tenant- Returns:
- The next value
-
getCurrentValue
public long getCurrentValue(String sequence, long objectId, long tenantId)
Description copied from interface:SequenceDAOGets the current value- Specified by:
getCurrentValuein interfaceSequenceDAO- Parameters:
sequence- name of the sequenceobjectId- value for the objectId fieldtenantId- identifier of the tenant- Returns:
- current value of the sequence
-
findByName
public List<Sequence> findByName(String name, long tenantId)
Description copied from interface:SequenceDAOFinds all sequences whose name starts with the passed name- Specified by:
findByNamein interfaceSequenceDAO- Parameters:
name- name of the sequencetenantId- identifier of the tenant- Returns:
- collection of sequences
-
findByAlternateKey
public Sequence findByAlternateKey(String name, long objectId, long tenantId)
Description copied from interface:SequenceDAOFinds the sequence by the given alternate key- Specified by:
findByAlternateKeyin interfaceSequenceDAO- Parameters:
name- name of the sequenceobjectId- value for the objectId fieldtenantId- identifier of the tenant- Returns:
- the sequence object
-
delete
public void delete(String name, long objectId, long tenantId) throws PersistenceException
Description copied from interface:SequenceDAODeletes the sequence- Specified by:
deletein interfaceSequenceDAO- Parameters:
name- name of the sequenceobjectId- value for the objectId fieldtenantId- identifier of the tenant- Throws:
PersistenceException- if a database error occurs
-
delete
public boolean delete(long id, int code) throws PersistenceExceptionDescription copied from interface:PersistentObjectDAOThis method deletes an entity and you can give a deletion code- Specified by:
deletein interfacePersistentObjectDAO<Sequence>- Overrides:
deletein classHibernatePersistentObjectDAO<Sequence>- Parameters:
id- ID of the entity which should be deletedcode- Deletion code- Returns:
- if the record has been successfully deleted
- Throws:
PersistenceException- raised in case of errors in the database
-
-