cz.muni.fi.pclis.commons.dao
Interface GenericDao<T extends DomainObject>

All Known Subinterfaces:
ContractAdditionDao, CourseDao, ExpectationPointDao, FeedbackDao, FeedbackTopicsDao, LearningContractDao, LearningContractsBehaviourDao, LearningExpectationsBehaviourDao, OnlineConsultationDao, OnlineConsultationRulesDao, PeerEvaluationDao, ProjectPackageDao, ScenarioCourseRelationDao, SelfEvaluationAssignmentDao, SelfEvaluationDao, SeminarDao, StudentEvaluationAssignmentDao, StudentEvaluationDao, TeamEvaluationAssignmentDao, TeamEvaluationDao, TeamProjectDao, TermDao, UploadedFileDao, UserBlogLocationDao, UserDao, UserToEducatableRelationDao
All Known Implementing Classes:
ContractAdditionDaoHibernate, CourseDaoHibernate, ExpectationPointDaoHibernate, FeedbackDaoHibernate, FeedbackTopicsDaoHibernate, GenericHibernateDao, LearningContractDaoHibernate, LearningContractsBehaviourDaoHibernate, LearningExpectationsBehaviourDaoHibernate, OnlineConsultationDaoHibernate, OnlineConsultationRulesDaoHibernate, PeerEvaluationDaoHibernate, ProjectPackageDaoHibernate, ScenarioCourseRelationDaoHibernate, SelfEvaluationAssignmentDaoHibernate, SelfEvaluationDaoHibernate, SeminarDaoHibernate, StudentEvaluationAssignmentDaoHibernate, StudentEvaluationDaoHibernate, TeamEvaluationAssignmentDaoHibernate, TeamEvaluationDaoHibernate, TeamProjectDaoHibernate, TermDaoHibernate, UploadedFileDaoHibernate, UserBlogLocationDaoHibernate, UserDaoHibernate, UserToEducatableRelationDaoHibernate

public interface GenericDao<T extends DomainObject>

A generic ancestor of all interfaces from the Dao layer.

Author:
Ľuboš Pecho

Method Summary
 boolean contains(T entity)
          Returns true if the entity is persisted
 boolean containsById(Long id)
          Returns true if entity with given id is persisted
 void create(T entity)
          Persists the entity
 void delete(T entity)
          Deletes the entity from the database
 List<T> findAll()
          Returns list of all entities in natural sort order.
 T findById(long id)
          Finds the object by its id
 T findById(long id, boolean lock)
          Finds the object by its id
 List<T> findByIDs(long[] IDs, boolean lck)
          Searches for the objects by their respective id's.
 void flush()
          flushes the cachce to the database
 Class<? extends T> getPersistentClass()
          Returns the type of the implemented dato
<T> T
refresh(T entity)
          Refreshes the entity from the database
 List runNamedQuery(String name, Map<String,Object> params)
          Runs named query
 Object runNamedQueryForSingleResult(String name, Map<String,Object> params)
          Runs named query which should return single result
 T save(T entity)
          Merge the state of the given entity into the current dao context.
 T update(T entity)
          Update the persistent instance with the identifier of the given detached instance.
 

Method Detail

findById

T findById(long id,
           boolean lock)
Finds the object by its id

Parameters:
id - of the object
lock - if the object should be locked in the database
Returns:

findById

T findById(long id)
Finds the object by its id

Parameters:
id - of the object
Returns:

findAll

List<T> findAll()
Returns list of all entities in natural sort order.

Returns:

findByIDs

List<T> findByIDs(long[] IDs,
                  boolean lck)
Searches for the objects by their respective id's. This method follows it's common sense.

Parameters:
IDs -
lck -
Returns:
objects

save

T save(T entity)
Merge the state of the given entity into the current dao context.

Parameters:
entity -
Returns:

update

T update(T entity)
Update the persistent instance with the identifier of the given detached instance. If there is a persistent instance with the same identifier, an exception is thrown. This operation cascades to associated instances if the association is mapped with cascade="save-update".

Parameters:
entity - a detached instance containing updated state
See Also:
Session.update(Object)

create

void create(T entity)
Persists the entity

Parameters:
entity -

contains

boolean contains(T entity)
Returns true if the entity is persisted

Parameters:
entity -
Returns:

containsById

boolean containsById(Long id)
Returns true if entity with given id is persisted

Parameters:
id -
Returns:

delete

void delete(T entity)
Deletes the entity from the database

Parameters:
entity -

refresh

<T> T refresh(T entity)
Refreshes the entity from the database

Parameters:
entity -
Returns:

flush

void flush()
flushes the cachce to the database


runNamedQuery

List runNamedQuery(String name,
                   Map<String,Object> params)
Runs named query

Parameters:
name - of the query
params -
Returns:

runNamedQueryForSingleResult

Object runNamedQueryForSingleResult(String name,
                                    Map<String,Object> params)
Runs named query which should return single result

Parameters:
name - of the query
params -
Returns:

getPersistentClass

Class<? extends T> getPersistentClass()
Returns the type of the implemented dato

Returns:


Copyright © 2009-2010 Faculty of Informatics, Masaryk university, Brno. All Rights Reserved.