Package com.logicaldoc.core.generic

# Class HibernateGenericDAO

java.lang.Object
com.logicaldoc.core.HibernatePersistentObjectDAO<Generic>
com.logicaldoc.core.generic.HibernateGenericDAO

All Implemented Interfaces:
  `GenericDAO`, `PersistentObjectDAO<Generic>`

@Repository("genericDAO") public class HibernateGenericDAO extends HibernatePersistentObjectDAO<Generic> implements GenericDAO
Hibernate implementation of `GenericDAO`

Since:
  4.0
Author:
  Marco Meschieri - LogicalDOC

## Field Summary

### Fields inherited from interface com.logicaldoc.core.PersistentObjectDAO

`ENTITY`

## Constructor Summary

Constructors
Constructor
Description
`HibernateGenericDAO()`

## Method Summary

Modifier and Type
Method
Description
`void`
`delete(long genericId, int code)`
This method deletes an entity and you can give a deletion code
`Generic`
`findByAlternateKey(String type, String subtype, Long qualifier, long tenantId)`
Finds a Generic by it's alternate key
`List<Generic>`
`findByTypeAndSubtype(String type, String subtype, Long qualifier, Long tenantId)`
Finds a Generic by it's alternate key.
`void`
`initialize(Generic generic)`
Doesn't do anything by default
`void`
`store(Generic entity)`
This method persists the entity object

### Methods inherited from class com.logicaldoc.core.HibernatePersistentObjectDAO

`bulkUpdate, count, deleteAll, evict, evict, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findIdsByWhere, getDatabaseMetadata, jdbcUpdate, jdbcUpdate, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString, setSessionFactory`

### 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, count, count, count, delete, deleteAll, deleteAll, evict, evict, findAll, findAll, findAllIds, findAllIds, findById, findById, findByObjectQuery, findByQuery, findByQuery, findByWhere, findByWhere, findIdsByWhere, findIdsByWhere, getDatabaseMetadata, getDbms, initialize, isMariaDB, isMySQL, isOracle, isPostgreSQL, isSQLServer, jdbcUpdate, jdbcUpdate, query, query, queryForDouble, queryForDouble, queryForInt, queryForInt, queryForList, queryForList, queryForList, queryForLong, queryForLong, queryForObject, queryForObject, queryForResultSet, queryForString, queryForString`

## Constructor Details

### HibernateGenericDAO

public HibernateGenericDAO()

## Method Details

### delete

public void delete(long genericId, int code) throws PersistenceException
Description copied from interface: `PersistentObjectDAO`
This method deletes an entity and you can give a deletion code

Specified by:
  `delete` in interface `PersistentObjectDAO<Generic>`
Overrides:
  `delete` in class `HibernatePersistentObjectDAO<Generic>`
Parameters:
  `genericId` - ID of the entity which should be deleted
  `code` - Deletion code
Throws:
  `PersistenceException` - raised in case of errors in the database

### findByAlternateKey

public Generic findByAlternateKey(String type, String subtype, Long qualifier, long tenantId) throws PersistenceException
Description copied from interface: `GenericDAO`
Finds a Generic by it's alternate key

Specified by:
  `findByAlternateKey` in interface `GenericDAO`
Parameters:
  `type` - The type(you can use like jollies and can be null)
  `subtype` - The sub-type(you can use like jollies and can be null)
  `qualifier` - the qualifier, can be null
  `tenantId` - ID of the owning tenant
Returns:
  Wanted generic or null
Throws:
  `PersistenceException` - Error in the database

### findByTypeAndSubtype

public List<Generic> findByTypeAndSubtype(String type, String subtype, Long qualifier, Long tenantId) throws PersistenceException
Description copied from interface: `GenericDAO`
Finds a Generic by it's alternate key. The search uses the like operator and each parameter can be null.

Specified by:
  `findByTypeAndSubtype` in interface `GenericDAO`
Parameters:
  `type` - The type(you can use like jollies and can be null)
  `subtype` - The sub-type(you can use like jollies and can be null)
  `qualifier` - the qualifier, can be null
  `tenantId` - ID of the owning tenant (optional)
Returns:
  The collection of found Generics
Throws:
  `PersistenceException` - Error in the database

### initialize

public void initialize(Generic generic)
Description copied from class: `HibernatePersistentObjectDAO`
Doesn't do anything by default

Specified by:
  `initialize` in interface `PersistentObjectDAO<Generic>`
Overrides:
  `initialize` in class `HibernatePersistentObjectDAO<Generic>`
Parameters:
  `generic` - The entity to be initialised

### store

public void store(Generic entity) throws PersistenceException
Description copied from interface: `PersistentObjectDAO`
This method persists the entity object

Specified by:
  `store` in interface `PersistentObjectDAO<Generic>`
Overrides:
  `store` in class `HibernatePersistentObjectDAO<Generic>`
Parameters:
  `entity` - entity to be stored
Throws:
  `PersistenceException` - raised in case of errors in the database