first hacking - get SPs loaded

This commit is contained in:
Michael Buckley 2024-04-26 15:07:48 -04:00
parent 746d7ae252
commit 0d2dfdeedb
5 changed files with 16 additions and 9 deletions

View File

@ -208,7 +208,8 @@ public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends B
if (idChunk.size() >= 2) {
List<ResourceTable> entityChunk = prefetchResourceTableHistoryAndProvenance(idChunk);
if (thePreFetchIndexes) {
// fixme mb
if (thePreFetchIndexes && false) {
prefetchByField("string", "myParamsString", ResourceTable::isParamsStringPopulated, entityChunk);
prefetchByField("token", "myParamsToken", ResourceTable::isParamsTokenPopulated, entityChunk);
@ -239,8 +240,10 @@ public abstract class BaseHapiFhirSystemDao<T extends IBaseBundle, MT> extends B
Query query = myEntityManager.createQuery("select r, h "
+ " FROM ResourceTable r "
+ " LEFT JOIN fetch ResourceHistoryTable h "
+ " on r.myVersion = h.myResourceVersion and r.id = h.myResourceId "
+ " left join fetch h.myProvenance "
// fixme make null safe
+ " on r.myVersion = h.myResourceVersion and r.id = h.myResourceId and r.myPartitionIdValue = h.myPartitionIdValue "
+ " left join fetch ResourceHistoryProvenanceEntity p "
+ " on p.myResourceHistoryTable = h and p.myPartitionIdValue = h.myPartitionIdValue "
+ " WHERE r.myId IN ( :IDS ) ");
query.setParameter("IDS", idChunk);

View File

@ -38,8 +38,10 @@ public interface IResourceHistoryTableDao extends JpaRepository<ResourceHistoryT
@Query("SELECT t FROM ResourceHistoryTable t WHERE t.myResourceId = :resId ORDER BY t.myResourceVersion ASC")
List<ResourceHistoryTable> findAllVersionsForResourceIdInOrder(@Param("resId") Long theId);
@Query(
"SELECT t FROM ResourceHistoryTable t LEFT OUTER JOIN FETCH t.myProvenance WHERE t.myResourceId = :id AND t.myResourceVersion = :version")
// fixme cosmos hack
@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);

View File

@ -65,8 +65,9 @@ import java.util.Date;
+ " p.REQUEST_ID as PROV_REQUEST_ID,"
+ " r.fhir_id as FHIR_ID "
+ "FROM HFJ_RESOURCE r "
+ " INNER JOIN HFJ_RES_VER h ON r.res_id = h.res_id and r.res_ver = h.res_ver"
+ " LEFT OUTER JOIN HFJ_RES_VER_PROV p ON p.res_ver_pid = h.pid ")
// fixme cosmos hack
+ " INNER JOIN HFJ_RES_VER h ON r.res_id = h.res_id and r.res_ver = h.res_ver and r.partition_id = h.partition_id"
+ " LEFT OUTER JOIN HFJ_RES_VER_PROV p ON p.res_ver_pid = h.pid and p.partition_id = h.partition_id")
public class ResourceSearchView implements IBaseResourceEntity, Serializable {
private static final long serialVersionUID = 1L;

View File

@ -672,7 +672,8 @@ public class SearchBuilder implements ISearchBuilder<JpaPid> {
// If we haven't added any predicates yet, we're doing a search for all resources. Make sure we add the
// partition ID predicate in that case.
if (!sqlBuilder.haveAtLeastOnePredicate()) {
// fixme cosmos hack
if (!sqlBuilder.haveAtLeastOnePredicate() || true) {
Condition partitionIdPredicate = sqlBuilder
.getOrCreateResourceTablePredicateBuilder()
.createPartitionIdPredicate(myRequestPartitionId);

View File

@ -962,7 +962,7 @@
<junit_version>5.10.1</junit_version>
<flexmark_version>0.64.8</flexmark_version>
<flyway_version>9.4.0</flyway_version>
<hibernate_version>6.4.1.Final</hibernate_version>
<hibernate_version>6.4.4.Final</hibernate_version>
<logback_version>1.4.14</logback_version>
<!-- Update lucene version when you update hibernate-search version - These go together! -->
<hibernate_search_version>7.0.0.Final</hibernate_search_version>