Interface BaseDao<T extends Identifiable>
- Type Parameters:
T- type
- All Known Subinterfaces:
AnalysisDao<T>,AnalysisResultSetDao<K,,O> AnnotationAssociationDao,ArrayDesignDao,AuditEventDao,AuditTrailDao,BaseVoEnabledDao<O,,VO> BibliographicReferenceDao,BioAssayDao,BioAssayDimensionDao,BioMaterialDao,BioSequenceDao,BlacklistedEntityDao,BlatAssociationDao,BlatResultDao,BrowsingDao<T>,CachedFilteringDao<O>,CachedFilteringVoEnabledDao<O,,VO> CharacteristicDao,ChromosomeDao,CoexpressionAnalysisDao,CoexpressionNodeDegreeDao,CompositeSequenceDao,CompoundDao,ContactDao,DatabaseEntryDao,DesignElementDataVectorDao<T>,DifferentialExpressionAnalysisDao,DifferentialExpressionResultDao,ExperimentalDesignDao,ExperimentalFactorDao,ExpressionAnalysisResultSetDao,ExpressionExperimentDao,ExpressionExperimentSetDao,ExpressionExperimentSubSetDao,ExternalDatabaseDao,FactorValueDao,FilteringDao<O>,FilteringVoEnabledDao<O,,VO> GeeqDao,Gene2GOAssociationDao,GeneAliasDao,GeneDao,GeneDiffExMetaAnalysisDao,GeneProductDao,GeneSetDao,PersonDao,PrincipalComponentAnalysisDao,ProcessedExpressionDataVectorDao,ProtocolDao,QuantitationTypeDao,RawAndProcessedExpressionDataVectorDao,RawExpressionDataVectorDao,ReferenceAssociationDao,StatementDao,TaxonDao,UnitDao,UserDao,UserGroupDao
- All Known Implementing Classes:
AbstractCriteriaFilteringVoEnabledDao,AbstractCuratableDao,AbstractDao,AbstractDesignElementDataVectorDao,AbstractFilteringVoEnabledDao,AbstractNoopFilteringVoEnabledDao,AbstractQueryFilteringVoEnabledDao,AbstractVoEnabledDao,AnnotationAssociationDaoImpl,ArrayDesignDaoImpl,AuditEventDaoImpl,AuditTrailDaoImpl,BibliographicReferenceDaoImpl,BioAssayDaoImpl,BioAssayDimensionDaoImpl,BioMaterialDaoImpl,BioSequenceDaoImpl,BlacklistedEntityDaoImpl,BlatAssociationDaoImpl,BlatResultDaoImpl,CharacteristicDaoImpl,ChromosomeDaoImpl,CoexpressionAnalysisDaoImpl,CoexpressionNodeDegreeDaoImpl,CompositeSequenceDaoImpl,CompoundDaoImpl,ContactDaoImpl,DatabaseEntryDaoImpl,DifferentialExpressionResultDaoImpl,ExperimentalDesignDaoImpl,ExperimentalFactorDaoImpl,ExpressionAnalysisResultSetDaoImpl,ExpressionExperimentDaoImpl,ExpressionExperimentSetDaoImpl,ExpressionExperimentSubSetDaoImpl,ExternalDatabaseDaoImpl,FactorValueDaoImpl,GeeqDaoImpl,Gene2GOAssociationDaoImpl,GeneAliasDaoImpl,GeneDaoImpl,GeneDiffExMetaAnalysisDaoImpl,GeneProductDaoImpl,GeneSetDaoImpl,GeneSetMemberDaoImpl,PersonDaoImpl,PrincipalComponentAnalysisDaoImpl,ProcessedExpressionDataVectorDaoImpl,ProtocolDaoImpl,QuantitationTypeDaoImpl,RawAndProcessedExpressionDataVectorDaoImpl,RawExpressionDataVectorDaoImpl,ReferenceAssociationDaoImpl,StatementDaoImpl,TaxonDaoImpl,UnitDaoImpl,UserDaoImpl,UserGroupDaoImpl
- Author:
- paul
-
Method Summary
Modifier and TypeMethodDescriptionlongcountAll()Counts all instances of specific class in the persistent storage.create(Collection<T> entities) Crates all the given entities in the persistent storage.Create an object.Does a look up for the given entity in the persistent storage, usually looking for a specific identifier ( either id or a string property).findOrCreate(T entity) Calls the find method, and if this method returns null, creates a new instance in the persistent storage.Obtain the element class ofBaseDao.Loads the entity with given id from the persistent storage.load(Collection<Long> ids) Loads entities with given ids form the persistent storage.loadAll()Loads all instanced of specific class from the persistent storage.loadReference(Long id) Load reference for an entity.loadReference(Collection<Long> ids) Load references for all the given IDs.reload(Collection<T> entities) Reload an entity from the persistent storage.Reload an entity from the persistent storage.voidRemove a persistent instance based on its ID.voidremove(Collection<T> entities) voidRemove a persistent instancesave(Collection<T> entities) Save all the given entities in the persistent storage.Create or update an entity whether it is transient.Stream all instance ofBaseDaofrom the persistent storage.streamAll(boolean createNewSession) Stream all instances ofBaseDaofrom the persistent storage.voidupdate(Collection<T> entities) void
-
Method Details
-
getElementClass
Obtain the element class ofBaseDao. -
create
Crates all the given entities in the persistent storage.- Parameters:
entities- the entities to be crated.- Returns:
- collection of entities representing the instances in the persistent storage that were created.
-
create
Create an object. If the entity type is immutable, this may also remove any existing entities identified by an appropriate 'find' method.- Parameters:
entity- the entity to create- Returns:
- the persistent version of the entity
-
save
Save all the given entities in the persistent storage.Unlike
update(Collection), this method does not attach the given entities to the persistence context; the returned values must be used instead.- See Also:
-
save
Create or update an entity whether it is transient.Unlike
update(Identifiable), this method does not attach the given entity to the persistence context and the returned value must be used instead.- See Also:
-
load
Loads entities with given ids form the persistent storage.- Parameters:
ids- the IDs of entities to be loaded. If some IDs are not found or null, they are skipped.- Returns:
- collection of entities with given ids.
-
load
Loads the entity with given id from the persistent storage.- Parameters:
id- the id of entity to load.- Returns:
- the entity with given ID, or null if such entity does not exist or if the passed ID was null
- See Also:
-
loadAll
Collection<T> loadAll()Loads all instanced of specific class from the persistent storage.- Returns:
- a collection containing all instances that are currently accessible.
-
loadReference
Load references for all the given IDs.Entities already in the session will be returned directly.
-
loadReference
Load reference for an entity.If the entity is already in the session, it will be returned instead. Note that unlike
load(Long), this method will not return null if the entity does not exist.You may freely access the
Identifiable.getId()field without triggering proxy initialization.- See Also:
-
reload
Reload an entity from the persistent storage.This does nothing if the entity is already in the session.
- Throws:
ObjectNotFoundException- if the entity does not exist.
-
reload
Reload an entity from the persistent storage.This does nothing for entities already in the session.
- Throws:
ObjectNotFoundException
-
countAll
long countAll()Counts all instances of specific class in the persistent storage.- Returns:
- number that is the amount of instances currently accessible.
-
streamAll
Stream all instance ofBaseDaofrom the persistent storage. -
streamAll
Stream all instances ofBaseDaofrom the persistent storage.- Parameters:
createNewSession- whether to create a new session for the stream, it will be closed when the stream is closed
-
remove
-
remove
Remove a persistent instance based on its ID.The implementer is trusted to know what type of object to remove.
Note that this method is to be avoided for
Securable, because it will leave cruft in the ACL tables. We may fix this by having this method return the removed object.- Parameters:
id- the ID of the entity to be removed
-
remove
Remove a persistent instance- Parameters:
entity- the entity to be removed
-
update
- Parameters:
entities- Update the entities. Not supported if the entities are immutable.
-
update
- Parameters:
entity- Update the entity. Not supported if the entity is immutable.
-
find
Does a look up for the given entity in the persistent storage, usually looking for a specific identifier ( either id or a string property).- Parameters:
entity- the entity to look for.- Returns:
- an entity that was found in the persistent storage, or null if no such entity was found.
-
findOrCreate
Calls the find method, and if this method returns null, creates a new instance in the persistent storage.- Parameters:
entity- the entity to look for and persist if not found.- Returns:
- the given entity, guaranteed to be representing an entity present in the persistent storage.
-