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

# SQL-219: ReportQueryProvider.GetLegalRepClaimsWithRelationship

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

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `providerLocationId` | Input | long | N/A | Method argument of `ReportQueryProvider.GetLegalRepClaimsWithRelationship` bound into the ORM expression; NHibernate generates the bind variable at runtime |
| `parentProviderLocationId` | Input | long | N/A | Method argument of `ReportQueryProvider.GetLegalRepClaimsWithRelationship` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CL_CLAIM_LEGAL_REPRESENTATIVE](../database-tables.md#cl_claim_legal_representative) | SELECT | CLAIM_ID (projection); PROVIDER_LOCATION_SEQ_NUM, PARENT_PROVIDER_LOC_SEQ_NUM, EXP_DATE (filters) |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/Reports/ReportQueryProvider.cs:49-53`.

```csharp
public IEnumerable<long> GetLegalRepClaimsWithRelationship(long providerLocationId, long parentProviderLocationId)
{
    return Factory.GetRepository<ClaimLegalRepresentative>()
            .Query()
            .Where(rep => rep.Provider.Id == providerLocationId
                && rep.ParentProvider.Id == parentProviderLocationId
                && rep.ExpirationDate == null).Select(x => x.ClaimId).ToList();
}
```

## 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 CCLR.CLAIM_ID
FROM CL_CLAIM_LEGAL_REPRESENTATIVE CCLR
WHERE CCLR.PROVIDER_LOCATION_SEQ_NUM = :providerLocationId
  AND CCLR.PARENT_PROVIDER_LOC_SEQ_NUM = :parentProviderLocationId
  AND CCLR.EXP_DATE IS NULL
```

Translation notes:
- `ClaimId` is a composite-key property (`ClaimLegalRepresentativeMap.cs:13`).

## Operations and processes

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

## Business rules

- [SD-BR-093 Active report record has a null expiration date](../business-rules.md#sd-br-093-active-report-record-has-a-null-expiration-date)

## Sources
- `Data/SAIF.Data/Queries/Claims/Reports/ReportQueryProvider.cs:49`
