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,MetadataFieldDAO,MetadataSchemaDAO,MetadataValueDAO,MostRecentChecksumDAO,OpenURLTrackerDAO,OrcidHistoryDAO,OrcidQueueDAO,OrcidTokenDAO,PoolTaskDAO,ProcessDAO,RegistrationDataDAO,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,MetadataFieldDAOImpl,MetadataSchemaDAOImpl,MetadataValueDAOImpl,MostRecentChecksumDAOImpl,OpenURLTrackerDAOImpl,OrcidHistoryDAOImpl,OrcidQueueDAOImpl,OrcidTokenDAOImpl,PoolTaskDAOImpl,ProcessDAOImpl,RegistrationDataDAOImpl,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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Tcreate(Context context, T t)Create a new instance of this type in the database.voiddelete(Context context, T t)Remove an instance from the database.List<T>findAll(Context context, Class<T> clazz)Fetch all persisted instances of a given object type.List<T>findAll(Context context, Class<T> clazz, Integer limit, Integer offset)Fetch all persisted instances of a given object type.TfindByID(Context context, Class clazz, int id)Fetch the entity identified by its legacy database identifier.TfindByID(Context context, Class clazz, UUID id)Fetch the entity identified by its UUID primary key.List<T>findMany(Context context, String query)Execute a JPQL query and return a collection of results.TfindUnique(Context context, String query)Execute a JPQL query returning a unique result.voidsave(Context context, T t)Persist this instance in the database.
-
-
-
Method Detail
-
create
T create(Context context, T t) throws SQLException
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
void save(Context context, T t) throws SQLException
Persist this instance in the database.- Parameters:
context- current DSpace context.t- type created here.- Throws:
SQLException- passed through.
-
delete
void delete(Context context, T t) throws SQLException
Remove an instance from the database.- Parameters:
context- current DSpace context.t- type of the instance to be removed.- Throws:
SQLException- passed through.
-
findAll
List<T> findAll(Context context, Class<T> clazz) throws SQLException
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
List<T> findAll(Context context, Class<T> clazz, Integer limit, Integer offset) throws SQLException
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
T findUnique(Context context, String query) throws SQLException
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
T findByID(Context context, Class clazz, int id) throws SQLException
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
T findByID(Context context, Class clazz, UUID id) throws SQLException
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
-
findMany
List<T> findMany(Context context, String query) throws SQLException
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
-
-