Package ubic.gemma.persistence.service
Interface BaseDao<T>
-
- 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
,DifferentialExpressionEvidenceDao
,DifferentialExpressionResultDao
,ExperimentalDesignDao
,ExperimentalEvidenceDao
,ExperimentalFactorDao
,ExpressionAnalysisResultSetDao
,ExpressionExperimentDao
,ExpressionExperimentSetDao
,ExpressionExperimentSubSetDao
,ExternalDatabaseDao
,FactorValueDao
,FilteringDao<O>
,FilteringVoEnabledDao<O,VO>
,GeeqDao
,Gene2GOAssociationDao
,GeneAliasDao
,GeneDao
,GeneDiffExMetaAnalysisDao
,GeneProductDao
,GenericEvidenceDao
,GenericExperimentDao
,GeneSetDao
,LiteratureEvidenceDao
,PersonDao
,PhenotypeAssociationDao
,PrincipalComponentAnalysisDao
,ProcessedExpressionDataVectorDao
,ProtocolDao
,QuantitationTypeDao
,RawAndProcessedExpressionDataVectorDao
,RawExpressionDataVectorDao
,ReferenceAssociationDao
,SingleExperimentAnalysisDao<T>
,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
,DifferentialExpressionEvidenceDaoImpl
,DifferentialExpressionResultDaoImpl
,ExperimentalDesignDaoImpl
,ExperimentalEvidenceDaoImpl
,ExperimentalFactorDaoImpl
,ExpressionAnalysisResultSetDaoImpl
,ExpressionExperimentDaoImpl
,ExpressionExperimentSetDaoImpl
,ExpressionExperimentSubSetDaoImpl
,ExternalDatabaseDaoImpl
,FactorValueDaoImpl
,GeeqDaoImpl
,Gene2GOAssociationDaoImpl
,GeneAliasDaoImpl
,GeneDaoImpl
,GeneDiffExMetaAnalysisDaoImpl
,GeneProductDaoImpl
,GenericEvidenceDaoImpl
,GenericExperimentDaoImpl
,GeneSetDaoImpl
,GeneSetMemberDaoImpl
,LiteratureEvidenceDaoImpl
,PersonDaoImpl
,PhenotypeAssociationDaoImpl
,PrincipalComponentAnalysisDaoImpl
,ProcessedExpressionDataVectorDaoImpl
,ProtocolDaoImpl
,QuantitationTypeDaoImpl
,RawAndProcessedExpressionDataVectorDaoImpl
,RawExpressionDataVectorDaoImpl
,ReferenceAssociationDaoImpl
,SingleExperimentAnalysisDaoBase
,TaxonDaoImpl
,UnitDaoImpl
,UserDaoImpl
,UserGroupDaoImpl
public interface BaseDao<T>
Interface that supports basic CRUD operations.- Author:
- paul
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
countAll()
Counts all instances of specific class in the persitent storage.Collection<T>
create(Collection<T> entities)
Crates all the given entities in the persistent storage.T
create(T entity)
Create an object.T
find(T entity)
Does a look up for the given entity in the persistent storage, usually looking for a specific identifier ( either id or a string property).T
findOrCreate(T entity)
Calls the find method, and if this method returns null, creates a new instance in the persistent storage.Class<? extends T>
getElementClass()
Obtain the element class ofBaseDao
.String
getIdentifierPropertyName()
Obtain the identifiable property name forBaseDao
.T
load(Long id)
Loads the entity with given id from the persistent storage.Collection<T>
load(Collection<Long> ids)
Loads entities with given ids form the persistent storage.Collection<T>
loadAll()
Loads all instanced of specific class from the persistent storage.T
loadReference(Long id)
Load reference for an entity.Collection<T>
loadReference(Collection<Long> ids)
Load references for all the given IDs.void
remove(Long id)
Remove a persistent instance based on its ID.void
remove(Collection<T> entities)
void
remove(T entity)
Remove a persistent instanceCollection<T>
save(Collection<T> entities)
Save all the given entities in the persistent storage.T
save(T entity)
Create or update an entity whether it is transient.void
update(Collection<T> entities)
void
update(T entity)
-
-
-
Method Detail
-
getIdentifierPropertyName
String getIdentifierPropertyName()
Obtain the identifiable property name forBaseDao
.
-
create
@CheckReturnValue Collection<T> create(Collection<T> entities)
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
@CheckReturnValue T create(T entity)
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
@CheckReturnValue Collection<T> save(Collection<T> entities)
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:
Session.persist(Object)
,Session.merge(Object)
-
save
@CheckReturnValue T save(T entity)
Create or update an entity whether it is transient.Unlike
update(Object)
, this method does not attach the given entity to the persistence context and the returned value must be used instead.- See Also:
Session.persist(Object)
,Session.merge(Object)
-
load
Collection<T> load(Collection<Long> ids)
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
@Nullable T load(Long id)
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:
Session.get(Class, Serializable)
-
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
Collection<T> loadReference(Collection<Long> ids)
Load references for all the given IDs.Entities already in the session will be returned directly.
-
loadReference
@Nonnull T loadReference(Long id)
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:
Session.load(Object, Serializable)
-
countAll
long countAll()
Counts all instances of specific class in the persitent storage.- Returns:
- number that is the amount of instances currently accessible.
-
remove
void remove(Collection<T> entities)
-
remove
void remove(Long id)
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 forSecurable
, 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
void remove(T entity)
Remove a persistent instance- Parameters:
entity
- the entity to be removed
-
update
void update(Collection<T> entities)
- Parameters:
entities
- Update the entities. Not supported if the entities are immutable.
-
update
void update(T entity)
- Parameters:
entity
- Update the entity. Not supported if the entity is immutable.
-
find
@Nullable @CheckReturnValue T find(T entity)
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
@CheckReturnValue T findOrCreate(T entity)
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.
-
-