---
title: "SQL-180: MedicareQueryProvider.GetBeneficiaries"
summary: Read operation for `MedicareQueryProvider.GetBeneficiaries`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-180: MedicareQueryProvider.GetBeneficiaries

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `MedicareQueryProvider.GetBeneficiaries`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-180 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `MedicareQueryProvider` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `GetBeneficiaries` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `submissionDateTime` | Input | DateTime | N/A | Method argument of `MedicareQueryProvider.GetBeneficiaries` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [MEDICARE_BENEFICIARY_QUERY](../database-tables.md#medicare_beneficiary_query) | SELECT | MEDICARE_QUERY_SEQ_NUM, UPDATE_NUM, PERSON_ID, SUBMISSION_DATE, MEDICARE_CLAIM_NUMBER, TAX_ID, LAST_NAME, FIRST_INITIAL, GENDER_CODE, BIRTH_DATE, MEDICARE_BENEFICIARY_FLAG, RESPONSE_MEDICARE_CLAIM_NUMBER, RESPONSE_TAX_ID, RESPONSE_LAST_NAME, RESPONSE_FIRST_INITIAL, RESPONSE_GENDER_CODE, RESPONSE_BIRTH_DATE, UPDATE_USER, UPDATE_DATE, PRIMARY_TAX_ID_FLAG |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:59`. The repository/queryable is initialised at `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:18`.

```csharp
// Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:18
medicareBeneficiaryRepository = factory.GetRepository<MedicareBeneficiaryQuery>().Query();

// Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:59
public IEnumerable<MedicareBeneficiaryQuery> GetBeneficiaries(DateTime submissionDateTime)
{
    return medicareBeneficiaryRepository.Where(x => x.SubmissionDate == submissionDateTime);
}
```

## Sample SQL

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  MBQ.MEDICARE_QUERY_SEQ_NUM,
  MBQ.UPDATE_NUM,
  MBQ.PERSON_ID,
  MBQ.SUBMISSION_DATE,
  MBQ.MEDICARE_CLAIM_NUMBER,
  MBQ.TAX_ID,
  MBQ.LAST_NAME,
  MBQ.FIRST_INITIAL,
  MBQ.GENDER_CODE,
  MBQ.BIRTH_DATE,
  MBQ.MEDICARE_BENEFICIARY_FLAG,
  MBQ.RESPONSE_MEDICARE_CLAIM_NUMBER,
  MBQ.RESPONSE_TAX_ID,
  MBQ.RESPONSE_LAST_NAME,
  MBQ.RESPONSE_FIRST_INITIAL,
  MBQ.RESPONSE_GENDER_CODE,
  MBQ.RESPONSE_BIRTH_DATE,
  MBQ.UPDATE_USER,
  MBQ.UPDATE_DATE,
  MBQ.PRIMARY_TAX_ID_FLAG
FROM MEDICARE_BENEFICIARY_QUERY MBQ
WHERE MBQ.SUBMISSION_DATE = :submissionDateTime
```

Translation notes:
- The query is deferred; it runs when the caller enumerates it.

## Operations and processes

- [Other query providers](../operations/other-query-providers.md)

## Business rules

- [SD-BR-095 Medicare history match requires all fields equal](../business-rules.md#sd-br-095-medicare-history-match-requires-all-fields-equal)

## Sources
- `Data/SAIF.Data/Queries/Claims/MedicareQueryProvider.cs:59`
