Package org.dspace.core
Interface GenericDAO<T>
- Type Parameters:
T- type which is accessed by this DAO, for example Item.
- All Known Subinterfaces:
BitstreamDAO,BitstreamFormatDAO,BundleDAO,ChecksumHistoryDAO,ChecksumResultDAO,ClaimedTaskDAO,CollectionDAO,CollectionRoleDAO,CommunityDAO,DOIDAO,DSpaceObjectDAO<T>,DSpaceObjectLegacySupportDAO<T>,EntityTypeDAO,EPersonDAO,Group2GroupCacheDAO,GroupDAO,HandleDAO,HarvestedCollectionDAO,HarvestedItemDAO,InProgressUserDAO,ItemDAO,LDNMessageDao,MetadataFieldDAO,MetadataSchemaDAO,MetadataValueDAO,MostRecentChecksumDAO,NotifyPatternToTriggerDao,NotifyServiceDao,NotifyServiceInboundPatternDao,OpenURLTrackerDAO,OrcidHistoryDAO,OrcidQueueDAO,OrcidTokenDAO,PoolTaskDAO,ProcessDAO,QAEventsDAO,RegistrationDataDAO,RegistrationDataMetadataDAO,RelationshipDAO,RelationshipTypeDAO,RequestItemDAO,ResourcePolicyDAO,SiteDAO,SubscriptionDAO,SubscriptionParameterDAO,SupervisionOrderDao,SystemWideAlertDAO,VersionDAO,VersionHistoryDAO,WebAppDAO,WorkflowItemRoleDAO,WorkspaceItemDAO,XmlWorkflowItemDAO
- All Known Implementing Classes:
AbstractHibernateDAO,AbstractHibernateDSODAO,BitstreamDAOImpl,BitstreamFormatDAOImpl,BundleDAOImpl,ChecksumHistoryDAOImpl,ChecksumResultDAOImpl,ClaimedTaskDAOImpl,CollectionDAOImpl,CollectionRoleDAOImpl,CommunityDAOImpl,DOIDAOImpl,EntityTypeDAOImpl,EPersonDAOImpl,Group2GroupCacheDAOImpl,GroupDAOImpl,HandleDAOImpl,HarvestedCollectionDAOImpl,HarvestedItemDAOImpl,InProgressUserDAOImpl,ItemDAOImpl,LDNMessageDaoImpl,MetadataFieldDAOImpl,MetadataSchemaDAOImpl,MetadataValueDAOImpl,MostRecentChecksumDAOImpl,NotifyPatternToTriggerDaoImpl,NotifyServiceDaoImpl,NotifyServiceInboundPatternDaoImpl,OpenURLTrackerDAOImpl,OrcidHistoryDAOImpl,OrcidQueueDAOImpl,OrcidTokenDAOImpl,PoolTaskDAOImpl,ProcessDAOImpl,QAEventsDAOImpl,RegistrationDataDAOImpl,RegistrationDataMetadataDAOImpl,RelationshipDAOImpl,RelationshipTypeDAOImpl,RequestItemDAOImpl,ResourcePolicyDAOImpl,SiteDAOImpl,SubscriptionDAOImpl,SubscriptionParameterDAOImpl,SupervisionOrderDaoImpl,SystemWideAlertDAOImpl,VersionDAOImpl,VersionHistoryDAOImpl,WebAppDAOImpl,WorkflowItemRoleDAOImpl,WorkspaceItemDAOImpl,XmlWorkflowItemDAOImpl
public interface GenericDAO<T>
Generic Database Access Object interface class that should be implemented by all DAOs.
It offers up a lot of general methods so these don't need to be declared again in each DAO.
The default Hibernate implementation offers up a class that implements all these methods.
- Author:
- kevinvandevelde at atmire.com
-
Method Summary
Modifier and TypeMethodDescriptionCreate a new instance of this type in the database.voidRemove an instance from the database.Fetch all persisted instances of a given object type.Fetch all persisted instances of a given object type.Fetch the entity identified by its legacy database identifier.Fetch the entity identified by its String primary key.Fetch the entity identified by its UUID primary key.Execute a JPQL query and return a collection of results.findUnique(Context context, String query) Execute a JPQL query returning a unique result.voidPersist this instance in the database.
-
Method Details
-
create
Create a new instance of this type in the database.- Parameters:
context- current DSpace context.t- type to be created.- Returns:
- entity tracking the created instance.
- Throws:
SQLException
-
save
Persist this instance in the database.- Parameters:
context- current DSpace context.t- type created here.- Throws:
SQLException- passed through.
-
delete
Remove an instance from the database.- Parameters:
context- current DSpace context.t- type of the instance to be removed.- Throws:
SQLException- passed through.
-
findAll
Fetch all persisted instances of a given object type.- Parameters:
context- The relevant DSpace Context.clazz- the desired type.- Returns:
- list of DAOs of the same type as clazz
- Throws:
SQLException- if database error
-
findAll
Fetch all persisted instances of a given object type.- Parameters:
context- The relevant DSpace Context.clazz- the desired type.limit- paging limitoffset- paging offset- Returns:
- list of DAOs of the same type as clazz
- Throws:
SQLException- if database error
-
findUnique
Execute a JPQL query returning a unique result.- Parameters:
context- The relevant DSpace Context.query- JPQL query string- Returns:
- a DAO specified by the query string
- Throws:
SQLException- if database error
-
findByID
Fetch the entity identified by its legacy database identifier.- Parameters:
context- current DSpace context.clazz- class of entity to be found.id- legacy database record ID.- Returns:
- the found entity.
- Throws:
SQLException- passed through.
-
findByID
Fetch the entity identified by its UUID primary key.- Parameters:
context- current DSpace context.clazz- class of entity to be found.id- primary key of the database record.- Returns:
- the found entity.
- Throws:
SQLException
-
findByID
Fetch the entity identified by its String primary key.- Parameters:
context- current DSpace context.clazz- class of entity to be found.id- primary key of the database record.- Returns:
- the found entity.
- Throws:
SQLException
-
findMany
Execute a JPQL query and return a collection of results.- Parameters:
context- The relevant DSpace Context.query- JPQL query string- Returns:
- list of DAOs specified by the query string
- Throws:
SQLException- if database error
-