Package ubic.gemma.persistence.service
Class AbstractVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
java.lang.Object
ubic.gemma.persistence.service.AbstractDao<O>
ubic.gemma.persistence.service.AbstractVoEnabledDao<O,VO>
- All Implemented Interfaces:
BaseDao<O>,BaseVoEnabledDao<O,VO>
- Direct Known Subclasses:
AbstractFilteringVoEnabledDao,AbstractNoopFilteringVoEnabledDao,BibliographicReferenceDaoImpl,BioAssayDimensionDaoImpl,BioMaterialDaoImpl,BioSequenceDaoImpl,BlacklistedEntityDaoImpl,BlatResultDaoImpl,ExperimentalFactorDaoImpl,ExpressionExperimentSetDaoImpl,GeeqDaoImpl,GeneProductDaoImpl
public abstract class AbstractVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
extends AbstractDao<O>
implements BaseVoEnabledDao<O,VO>
Created by tesarst on 01/06/17.
Base DAO providing value object functionality.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intAmount of time in milliseconds after which a query (including post-processing) should be reported.Fields inherited from class ubic.gemma.persistence.service.AbstractDao
log -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractVoEnabledDao(Class<? extends O> elementClass, SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract VOdoLoadValueObject(O entity) Load a value object for a given entity.doLoadValueObjects(Collection<O> entities) Load all the value objects for the given entities.Should be overridden for any entity that requires special handling of larger amounts of VOs.final VOloadValueObject(O entity) Load a value object corresponding to an entityfinal VOloadValueObjects(Collection<O> entities) The default implementation callsloadValueObject(Identifiable)for each entity and filters out nulls.protected voidpostProcessValueObjects(List<VO> vos) Post-process VOs in bulk.Methods inherited from class ubic.gemma.persistence.service.AbstractDao
countAll, create, create, find, findByProperty, findByPropertyIn, findOneByProperty, findOrCreate, getBatchSize, getElementClass, getEntityName, getIdentifierPropertyName, getSessionFactory, load, load, loadAll, loadReference, loadReference, reload, reload, remove, remove, remove, save, save, streamAll, streamAll, streamQuery, update, update
-
Field Details
-
REPORT_SLOW_QUERY_AFTER_MS
protected static final int REPORT_SLOW_QUERY_AFTER_MSAmount of time in milliseconds after which a query (including post-processing) should be reported.If there is no way to perform a given query under this amount of time, consider paginating results or optimizing how Hibernate entities are loaded or cached.
- See Also:
-
-
Constructor Details
-
AbstractVoEnabledDao
-
-
Method Details
-
doLoadValueObject
Load a value object for a given entity.This should be fast and efficient, and avoid any database query or post-processing. If you need to perform additional queries, implement
postProcessValueObjects(List)instead. -
doLoadValueObjects
Load all the value objects for the given entities.The default is to apply
doLoadValueObject(Identifiable)on each entry and weed out null elements.This method should be fast and any post-processing should happen in
postProcessValueObjects(List). -
postProcessValueObjects
Post-process VOs in bulk.Use this as an opportunity to load extra informations that could not be populated in the initial
doLoadValueObject(Identifiable)ordoLoadValueObjects(Collection) -
loadValueObject
Description copied from interface:BaseVoEnabledDaoLoad a value object corresponding to an entity- Specified by:
loadValueObjectin interfaceBaseVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - Parameters:
entity- the entity to turn into a value object- Returns:
- a value object
-
loadValueObjectById
- Specified by:
loadValueObjectByIdin interfaceBaseVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - Returns:
- a value object, or null if it could not be constructed
-
loadValueObjects
The default implementation callsloadValueObject(Identifiable)for each entity and filters out nulls.- Specified by:
loadValueObjectsin interfaceBaseVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - Parameters:
entities- the entities to turn into value objects- Returns:
- a collection of value objects
-
loadValueObjectsByIds
- Specified by:
loadValueObjectsByIdsin interfaceBaseVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>>
-
loadAllValueObjects
Should be overridden for any entity that requires special handling of larger amounts of VOs.- Specified by:
loadAllValueObjectsin interfaceBaseVoEnabledDao<O extends Identifiable,VO extends IdentifiableValueObject<O>> - Returns:
- VOs of all instances of the class this DAO manages.
-