Skip to content

Fix SampleDAOImpl.getUnassignedSampleByAccessionNumber — invalid HQL property r.canceled #4114

Description

@Agaba-derrick

Bug

The HQL query in SampleDAOImpl.getUnassignedSampleByAccessionNumber filters on r.canceled = false, but Referral has no canceled property — it uses a ReferralStatus enum instead. This causes the query to fail/error out.

Note: this is unrelated to #3642 / #3701, which fixed SampleTypeRequestDAOImpl binding sampleId as Integer instead of String on a different code path.

Fix

Align the query with ReferralDAOImpl's pattern, e.g. filter using r.status != 'CANCELED' instead of r.canceled = false.

Related tests (blocked, currently commented out in SampleRestControllerTest)

  • getUnassignedSampleByAccessionNumber_shouldReturn500_dueToExistingCodebaseBug
  • getUnassignedSampleByAccessionNumber_shouldReturn200WithNotStartedAnalyses_whenUnassignedReferralExists
  • getUnassignedSampleByAccessionNumber_shouldReturn404_whenSampleNotFound
  • getUnassignedSampleByAccessionNumber_shouldReturn404_whenSampleHasNoUnassignedReferral

Acceptance Criteria

  • SampleDAOImpl.getUnassignedSampleByAccessionNumber query fixed to use valid Referral properties
  • Query returns expected results for assigned/unassigned/nonexistent samples
  • Parent issue's tests can be uncommented and pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    GSoCGSoC candidate contributionbackendJava service/controller/DAO changesbug fixFixes incorrect behavior

    Type

    No type

    Projects

    Status
    Need a Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions