Interface IResourceHistoryTableDao

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

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

    • findAllVersionsForResourceIdInOrder

      @Query("SELECT t FROM ResourceHistoryTable t WHERE t.myResourcePid = :resId ORDER BY t.myResourceVersion ASC") List<ResourceHistoryTable> findAllVersionsForResourceIdInOrder(@Param("resId") JpaPidFk 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.
    • findForIdAndVersion

      @Query("SELECT t FROM ResourceHistoryTable t WHERE t.myResourcePid = :id AND t.myResourceVersion = :version") ResourceHistoryTable findForIdAndVersion(@Param("id") JpaPidFk theId, @Param("version") long theVersion)
    • findForResourceId

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

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

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

      @Query("SELECT v.myId FROM ResourceHistoryTable v LEFT OUTER JOIN ResourceTable t ON (v.myResourceTable = t) WHERE v.myResourceVersion <> t.myVersion AND t.myResourceType = :restype") org.springframework.data.domain.Slice<ResourceHistoryTablePk> 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.myResourceTable = t) WHERE v.myResourceVersion <> t.myVersion") org.springframework.data.domain.Slice<ResourceHistoryTablePk> findIdsOfPreviousVersionsOfResources(org.springframework.data.domain.Pageable thePage)
    • updateVersion

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

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

      @Modifying @Query("UPDATE ResourceHistoryTable r SET r.myResourceTextVc = null, r.myResource = :text, r.myEncoding = \'JSONC\' WHERE r.myId = :pid") void updateNonInlinedContents(@Param("text") byte[] theText, @Param("pid") ResourceHistoryTablePk thePid)
      This method is only for use in unit tests - It is used to move the stored resource body contents from the new RES_TEXT_VC column to the legacy RES_TEXT column, which is where data may have been stored by versions of HAPI FHIR prior to 7.0.0
      Since:
      7.0.0
    • findCurrentVersionsByResourcePidsAndFetchResourceTable

      @Query("SELECT v FROM ResourceHistoryTable v JOIN FETCH v.myResourceTable t WHERE v.myResourcePid IN (:pids) AND t.myVersion = v.myResourceVersion") List<ResourceHistoryTable> findCurrentVersionsByResourcePidsAndFetchResourceTable(@Param("pids") List<JpaPidFk> theVersionlessPids)