eu.etaxonomy.cdm.persistence.dao.common
Interface ICdmEntityDao<T extends CdmBase>

All Known Subinterfaces:
IAgentDao, IAnnotatableDao<T>, IAnnotationDao, IClassificationDao, ICollectionDao, IDefinedTermDao, IDescriptionDao, IDescriptionElementDao, IEventBaseDao, IFeatureDao, IFeatureNodeDao, IFeatureTreeDao, IGrantedAuthorityDao, IGroupDao, IHomotypicalGroupDao, IIdentifiableDao<T>, ILanguageStringBaseDao<T>, ILanguageStringDao, ILsidAuthorityDao, IMarkerDao, IMediaDao, IMediaRepresentationDao, IMediaRepresentationPartDao, INomenclaturalStatusDao, IOccurrenceDao, IOrderedTermVocabularyDao, IOriginalSourceDao, IPolytomousKeyDao, IPolytomousKeyNodeDao, IReferenceDao, IReferencedEntityDao<T>, IRepresentationDao, IStatisticalMeasurementValueDao, ITaxonDao, ITaxonNameDao, ITaxonNodeDao, ITermVocabularyDao, ITypeDesignationDao, IUserDao, IVersionableDao<T>, IWorkingSetDao
All Known Implementing Classes:
AgentDaoImpl, AnnotatableDaoImpl, AnnotationDaoImpl, CdmEntityDaoBase, CdmGenericDaoImpl, ClassificationDaoHibernateImpl, CollectionDaoHibernateImpl, DefinedTermDaoImpl, DescriptionDaoImpl, DescriptionElementDaoImpl, EventBaseDaoImpl, FeatureDaoImpl, FeatureNodeDaoImpl, FeatureTreeDaoImpl, GrantedAuthorityDaoImpl, GroupDaoImpl, HomotypicalGroupDaoHibernateImpl, IdentifiableDaoBase, LanguageStringBaseDaoImpl, LanguageStringDaoImpl, LsidAuthorityDaoImpl, MarkerDaoImpl, MediaDaoHibernateImpl, MediaRepresentationHibernateImpl, MediaRepresentationPartHibernateImpl, NomenclaturalStatusDaoHibernateImpl, OccurrenceDaoHibernateImpl, OrderedTermVocabularyDaoImpl, OriginalSourceDaoImpl, PolytomousKeyDaoImpl, PolytomousKeyNodeDaoImpl, ReferenceDaoHibernateImpl, ReferencedEntityDaoImpl, RepresentationDaoImpl, StatisticalMeasurementValueDaoImpl, TaxonDaoHibernateImpl, TaxonNameDaoHibernateImpl, TaxonNodeDaoHibernateImpl, TermVocabularyDaoImpl, TypeDesignationHibernateImpl, UserDaoImpl, VersionableDaoBase, WorkingSetDao

public interface ICdmEntityDao<T extends CdmBase>

an data access interface that all data access classes implement

Version:
1.0
Author:
m.doering

Method Summary
 void clear()
           
 int count()
           
 int count(Class<? extends T> clazz)
          Returns the number of objects of type - which must extend T
 int count(T example, Set<String> includeProperties)
          Method that counts the number of objects matching the example provided.
 UUID delete(T persistentObject)
           
 Boolean exists(UUID uuid)
           
 T findById(int id)
           
 T findByUuid(UUID Uuid)
           
 void flush()
          FIXME Should this method exist : I would expect flushing of a session to be something that a DAO should hide?
 org.hibernate.Session getSession()
           
 Class<T> getType()
          Convenience method which makes it easy to discover what type of object this DAO returns at runtime
 List<Object[]> group(Class<? extends T> clazz, Integer limit, Integer start, List<Grouping> groups, List<String> propertyPaths)
          Returns a sublist of objects matching the grouping projections supplied using the groups parameter It would be nice to have an equivalent countGroups method, but for the moment hibernate doesn't seem to support this (HHH-3238 - impossible to get the rowcount for a criteria that has projections)
 List<T> list(Class<? extends T> type, Integer limit, Integer start)
          Returns a sublist of CdmBase instances of type stored in the database.
 List<T> list(Class<? extends T> type, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a sublist of CdmBase instances stored in the database.
 List<T> list(Collection<UUID> uuids, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
           
 List<T> list(Integer limit, Integer start)
          Returns a sublist of CdmBase instances stored in the database.
 List<T> list(Integer limit, Integer start, List<OrderHint> orderHints)
          Returns a sublist of CdmBase instances stored in the database.
 List<T> list(Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths)
          Returns a sublist of CdmBase instances stored in the database.
 List<T> list(T example, Set<String> includeProperties, Integer limit, Integer start, List<OrderHint> orderHints, List<String> propertyPaths)
          Method that lists the objects matching the example provided.
 List<T> listByIds(Collection<Integer> ids, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths)
           
 T load(int id, List<String> propertyPaths)
          Finds the cdm entity specified by the id parameter and recursively initializes all bean properties given in the propertyPaths parameter.
 T load(UUID uuid)
          Finds the cdm entity specified by the uuid parameter and initializes all its *ToOne relations.
 T load(UUID uuid, List<String> propertyPaths)
          Finds the cdm entity specified by the uuid parameter and recursively initializes all bean properties given in the propertyPaths parameter.
 void lock(T t, org.hibernate.LockMode lockMode)
          Obtains the specified LockMode on the supplied object
 T merge(T transientObject)
           
 UUID refresh(T persistentObject)
           
 void refresh(T t, org.hibernate.LockMode lockMode, List<String> propertyPaths)
          Refreshes the state of the supplied object using the given LockMode (e.g.
 T replace(T x, T y)
          Globally replace all references to instance t1 with t2 (including NOTE: This replaces all non-bidirectional relationships where type T is on the "owning" side of the relationship (since the "owned" objects are, in theory, sub-components of the entity and this kind of global replace doesn't really make sense Consequently it is a good idea to either map such owned relationships with cascading semantics (i.e.
 List<T> rows(String tableName, int limit, int start)
           
 UUID save(T newOrManagedObject)
           
 Map<UUID,T> saveAll(Collection<T> cdmObjCollection)
           
 UUID saveOrUpdate(T transientObject)
           
 Map<UUID,T> saveOrUpdateAll(Collection<T> cdmObjCollection)
           
 UUID update(T transientObject)
           
 

Method Detail

saveOrUpdate

UUID saveOrUpdate(T transientObject)
                  throws org.springframework.dao.DataAccessException
Parameters:
transientObject -
Returns:
Throws:
org.springframework.dao.DataAccessException

save

UUID save(T newOrManagedObject)
          throws org.springframework.dao.DataAccessException
Parameters:
newOrManagedObject -
Returns:
Throws:
org.springframework.dao.DataAccessException

merge

T merge(T transientObject)
                        throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

lock

void lock(T t,
          org.hibernate.LockMode lockMode)
          throws org.springframework.dao.DataAccessException
Obtains the specified LockMode on the supplied object

Parameters:
t -
lockMode -
Throws:
org.springframework.dao.DataAccessException

replace

T replace(T x,
          T y)
Globally replace all references to instance t1 with t2 (including NOTE: This replaces all non-bidirectional relationships where type T is on the "owning" side of the relationship (since the "owned" objects are, in theory, sub-components of the entity and this kind of global replace doesn't really make sense Consequently it is a good idea to either map such owned relationships with cascading semantics (i.e. CascadeType.DELETE, @OneToMany(orphanRemoval=true)) allowing them to be saved, updated, and deleted along with the owning entity automatically.

Parameters:
x - the object to replace, must not be null
y - the object that will replace. If y is null, then x will be removed from all collections and all properties that refer to x will be replaced with null
Returns:
T the replaced object

refresh

void refresh(T t,
             org.hibernate.LockMode lockMode,
             List<String> propertyPaths)
             throws org.springframework.dao.DataAccessException
Refreshes the state of the supplied object using the given LockMode (e.g. use LockMode.READ to bypass the second-level cache and session cache and query the database directly) All bean properties given in the propertyPaths parameter are recursively initialized.

For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List)

Parameters:
t -
lockMode -
propertyPaths -
Throws:
org.springframework.dao.DataAccessException

clear

void clear()
           throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

getSession

org.hibernate.Session getSession()
                                 throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

saveAll

Map<UUID,T> saveAll(Collection<T> cdmObjCollection)
                                    throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

saveOrUpdateAll

Map<UUID,T> saveOrUpdateAll(Collection<T> cdmObjCollection)

update

UUID update(T transientObject)
            throws org.springframework.dao.DataAccessException
Parameters:
transientObject -
Returns:
Throws:
org.springframework.dao.DataAccessException

refresh

UUID refresh(T persistentObject)
             throws org.springframework.dao.DataAccessException
Parameters:
persistentObject -
Returns:
Throws:
org.springframework.dao.DataAccessException

delete

UUID delete(T persistentObject)
            throws org.springframework.dao.DataAccessException
Parameters:
persistentObject -
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Integer limit,
             Integer start)
                             throws org.springframework.dao.DataAccessException
Returns a sublist of CdmBase instances stored in the database. A maximum of 'limit' objects are returned, starting at object with index 'start'.

Parameters:
limit - the maximum number of entities returned (can be null to return all entities)
start -
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Integer limit,
             Integer start,
             List<OrderHint> orderHints)
Returns a sublist of CdmBase instances stored in the database. A maximum of 'limit' objects are returned, starting at object with index 'start'.

Parameters:
limit - the maximum number of entities returned (can be null to return all entities)
start -
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Class<? extends T> type,
             Integer limit,
             Integer start,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
Returns a sublist of CdmBase instances stored in the database. A maximum of 'limit' objects are returned, starting at object with index 'start'.

Parameters:
type -
limit - the maximum number of entities returned (can be null to return all entities)
start -
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Integer limit,
             Integer start,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
Returns a sublist of CdmBase instances stored in the database. A maximum of 'limit' objects are returned, starting at object with index 'start'. The bean properties specified by the parameter propertyPaths and recursively initialized for each of the entities in the resultset For detailed description and examples redarding propertyPaths please refer to: IBeanInitializer.initialize(Object, List)

Parameters:
limit - the maximum number of entities returned (can be null to return all entities)
start -
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or authorTeam.persistentTitleCache
propertyPaths -
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Class<? extends T> type,
             Integer limit,
             Integer start)
                             throws org.springframework.dao.DataAccessException
Returns a sublist of CdmBase instances of type stored in the database. A maximum of 'limit' objects are returned, starting at object with index 'start'.

Parameters:
limit - the maximum number of entities returned (can be null to return all entities)
start -
Returns:
Throws:
org.springframework.dao.DataAccessException

group

List<Object[]> group(Class<? extends T> clazz,
                     Integer limit,
                     Integer start,
                     List<Grouping> groups,
                     List<String> propertyPaths)
Returns a sublist of objects matching the grouping projections supplied using the groups parameter It would be nice to have an equivalent countGroups method, but for the moment hibernate doesn't seem to support this (HHH-3238 - impossible to get the rowcount for a criteria that has projections)

Parameters:
clazz - Restrict the query to objects of a certain class, or null for all objects of type T or subclasses
limit - the maximum number of entities returned (can be null to return all entities)
start - The (0-based) offset from the start of the recordset
groups - The grouping objects representing a projection, plus an optional ordering on that projected property
propertyPaths - paths initialized on the returned objects - only applied to the objects returned from the first grouping
Returns:
a list of arrays of objects, each matching the grouping objects supplied in the parameters.

rows

List<T> rows(String tableName,
             int limit,
             int start)
                             throws org.springframework.dao.DataAccessException
Throws:
org.springframework.dao.DataAccessException

findById

T findById(int id)
                           throws org.springframework.dao.DataAccessException
Parameters:
id -
Returns:
Throws:
org.springframework.dao.DataAccessException

load

T load(int id,
       List<String> propertyPaths)
Finds the cdm entity specified by the id parameter and recursively initializes all bean properties given in the propertyPaths parameter.

For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List)

Parameters:
id -
propertyPaths - properties to be initialized
Returns:

listByIds

List<T> listByIds(Collection<Integer> ids,
                  Integer pageSize,
                  Integer pageNumber,
                  List<OrderHint> orderHints,
                  List<String> propertyPaths)
                                  throws org.springframework.dao.DataAccessException
Parameters:
ids -
pageSize -
pageNumber -
orderHints -
propertyPaths -
Returns:
Throws:
org.springframework.dao.DataAccessException

findByUuid

T findByUuid(UUID Uuid)
                             throws org.springframework.dao.DataAccessException
Parameters:
Uuid -
Returns:
Throws:
org.springframework.dao.DataAccessException

list

List<T> list(Collection<UUID> uuids,
             Integer pageSize,
             Integer pageNumber,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
                             throws org.springframework.dao.DataAccessException
Parameters:
uuids -
pageSize -
pageNumber -
orderHints -
propertyPaths -
Returns:
Throws:
org.springframework.dao.DataAccessException

load

T load(UUID uuid)
Finds the cdm entity specified by the uuid parameter and initializes all its *ToOne relations.

Parameters:
uuid -
Returns:

load

T load(UUID uuid,
       List<String> propertyPaths)
Finds the cdm entity specified by the uuid parameter and recursively initializes all bean properties given in the propertyPaths parameter.

For detailed description and examples please refer to: IBeanInitializer.initialize(Object, List)

Parameters:
uuid -
propertyPaths - properties to be initialized
Returns:

exists

Boolean exists(UUID uuid)
               throws org.springframework.dao.DataAccessException
Parameters:
uuid -
Returns:
Throws:
org.springframework.dao.DataAccessException

count

int count()

count

int count(Class<? extends T> clazz)
Returns the number of objects of type - which must extend T

Type Parameters:
T -
Parameters:
clazz -
Returns:

flush

void flush()
FIXME Should this method exist : I would expect flushing of a session to be something that a DAO should hide?


getType

Class<T> getType()
Convenience method which makes it easy to discover what type of object this DAO returns at runtime

Returns:

count

int count(T example,
          Set<String> includeProperties)
Method that counts the number of objects matching the example provided. The includeProperties property is used to specify which properties of the example are used. If includeProperties is null or empty, then all literal properties are used (restrictions are applied as in the Hibernate Query-By-Example API call Example.create(object)). If includeProperties is not empty then only literal properties that are named in the set are used to create restrictions, *PLUS* any *ToOne related entities. Related entities are matched on ID, not by their internal literal values (e.g. the call is criteria.add(Restrictions.eq(property,relatedObject)), not criteria.createCriteria(property).add(Example.create(relatedObject)))

Parameters:
example -
includeProperties -
Returns:
a count of matching objects

list

List<T> list(T example,
             Set<String> includeProperties,
             Integer limit,
             Integer start,
             List<OrderHint> orderHints,
             List<String> propertyPaths)
Method that lists the objects matching the example provided. The includeProperties property is used to specify which properties of the example are used. If includeProperties is null or empty, then all literal properties are used (restrictions are applied as in the Hibernate Query-By-Example API call Example.create(object)). If includeProperties is not empty then only literal properties that are named in the set are used to create restrictions, *PLUS* any *ToOne related entities. Related entities are matched on ID, not by their internal literal values (e.g. the call is criteria.add(Restrictions.eq(property,relatedObject)), not criteria.createCriteria(property).add(Example.create(relatedObject)))

Parameters:
example -
includeProperties -
limit - the maximum number of entities returned (can be null to return all entities)
start - The (0-based) offset from the start of the recordset
orderHints - Supports path like orderHints.propertyNames which include *-to-one properties like createdBy.username or
propertyPaths - paths initialized on the returned objects - only applied to the objects returned from the first grouping
Returns:
a list of matching objects


Copyright © 2007-2013 EDIT. All Rights Reserved.