Interface IResourceHistoryTableDao

All Superinterfaces:
org.springframework.data.repository.CrudRepository<ResourceHistoryTable,Long>, IHapiFhirJpaRepository, org.springframework.data.jpa.repository.JpaRepository<ResourceHistoryTable,Long>, org.springframework.data.repository.ListCrudRepository<ResourceHistoryTable,Long>, org.springframework.data.repository.ListPagingAndSortingRepository<ResourceHistoryTable,Long>, org.springframework.data.repository.PagingAndSortingRepository<ResourceHistoryTable,Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ResourceHistoryTable>, org.springframework.data.repository.Repository<ResourceHistoryTable,Long>

public interface IResourceHistoryTableDao extends org.springframework.data.jpa.repository.JpaRepository<ResourceHistoryTable,Long>, IHapiFhirJpaRepository
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    This is really only intended for unit tests - There can be many versions of resources in the real world, use a pageable query for real uses.
    findForIdAndVersionAndFetchProvenance(long theId, long theVersion)
     
    org.springframework.data.domain.Slice<Long>
    findForResourceId(org.springframework.data.domain.Pageable thePage, Long theId, Long theDontWantVersion)
     
    org.springframework.data.domain.Slice<ResourceHistoryTable>
    findForResourceIdAndReturnEntitiesAndFetchProvenance(org.springframework.data.domain.Pageable thePage, Long theId, Long theDontWantVersion)
     
    org.springframework.data.domain.Slice<Long>
    findIdsOfPreviousVersionsOfResourceId(org.springframework.data.domain.Pageable thePage, Long theResourceId)
     
    org.springframework.data.domain.Slice<Long>
    findIdsOfPreviousVersionsOfResources(org.springframework.data.domain.Pageable thePage)
     
    org.springframework.data.domain.Slice<Long>
    findIdsOfPreviousVersionsOfResources(org.springframework.data.domain.Pageable thePage, String theResourceName)
     
    void
    updateVersion(long theId, long theOldVersion, long theNewVersion)
     

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • findAllVersionsForResourceIdInOrder

      @Query("SELECT t FROM ResourceHistoryTable t WHERE t.myResourceId = :resId ORDER BY t.myResourceVersion ASC") List<ResourceHistoryTable> findAllVersionsForResourceIdInOrder(@Param("resId") Long theId)
      This is really only intended for unit tests - There can be many versions of resources in the real world, use a pageable query for real uses.
    • findForIdAndVersionAndFetchProvenance

      @Query("SELECT t FROM ResourceHistoryTable t LEFT OUTER JOIN FETCH t.myProvenance WHERE t.myResourceId = :id AND t.myResourceVersion = :version") ResourceHistoryTable findForIdAndVersionAndFetchProvenance(@Param("id") long theId, @Param("version") long theVersion)
    • findForResourceId

      @Query("SELECT t.myId FROM ResourceHistoryTable t WHERE t.myResourceId = :resId AND t.myResourceVersion <> :dontWantVersion") org.springframework.data.domain.Slice<Long> findForResourceId(org.springframework.data.domain.Pageable thePage, @Param("resId") Long theId, @Param("dontWantVersion") Long theDontWantVersion)
    • findForResourceIdAndReturnEntitiesAndFetchProvenance

      @Query("SELECT t FROM ResourceHistoryTable t LEFT OUTER JOIN FETCH t.myProvenance WHERE t.myResourceId = :resId AND t.myResourceVersion <> :dontWantVersion") org.springframework.data.domain.Slice<ResourceHistoryTable> findForResourceIdAndReturnEntitiesAndFetchProvenance(org.springframework.data.domain.Pageable thePage, @Param("resId") Long theId, @Param("dontWantVersion") Long theDontWantVersion)
    • findIdsOfPreviousVersionsOfResourceId

      @Query("SELECT v.myId FROM ResourceHistoryTable v LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) WHERE v.myResourceVersion <> t.myVersion AND t.myId = :resId") org.springframework.data.domain.Slice<Long> findIdsOfPreviousVersionsOfResourceId(org.springframework.data.domain.Pageable thePage, @Param("resId") Long theResourceId)
    • findIdsOfPreviousVersionsOfResources

      @Query("SELECT v.myId FROM ResourceHistoryTable v LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) WHERE v.myResourceVersion <> t.myVersion AND t.myResourceType = :restype") org.springframework.data.domain.Slice<Long> findIdsOfPreviousVersionsOfResources(org.springframework.data.domain.Pageable thePage, @Param("restype") String theResourceName)
    • findIdsOfPreviousVersionsOfResources

      @Query("SELECT v.myId FROM ResourceHistoryTable v LEFT OUTER JOIN ResourceTable t ON (v.myResourceId = t.myId) WHERE v.myResourceVersion <> t.myVersion") org.springframework.data.domain.Slice<Long> findIdsOfPreviousVersionsOfResources(org.springframework.data.domain.Pageable thePage)
    • updateVersion

      @Modifying @Query("UPDATE ResourceHistoryTable r SET r.myResourceVersion = :newVersion WHERE r.myResourceId = :id AND r.myResourceVersion = :oldVersion") void updateVersion(@Param("id") long theId, @Param("oldVersion") long theOldVersion, @Param("newVersion") long theNewVersion)
    • deleteByPid

      @Modifying @Query("DELETE FROM ResourceHistoryTable t WHERE t.myId = :pid") void deleteByPid(@Param("pid") Long theId)