---
title: "SQL-275: Retrieve ProviderLocation"
summary: Read operation against ProviderLocation via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-275: Retrieve ProviderLocation

This statement retrieves a single `ProviderLocation` by its identifier via NHibernate LINQ, used to resolve the billing provider for an authorization in `AuthorizationService.CreateAuthorization` and `AuthorizationService.UpdateAuthorization`, executed from `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs (L177, L257)`.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:BillingProviderId` | Input | long | N/A | `authorization.BillingProviderId` — matched against `PROVIDER_LOCATION_SEQ_NUM` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [PROVIDER_LOCATION](../database-tables.md#provider_location) | SELECT | `PROVIDER_LOCATION_SEQ_NUM`, `UPDATE_NUM`, `BUSINESS_NAME`, `PAYEE_NAME`, `PRIMARY_LOCATION_FLAG`, `BUSINESS_FLAG`, `PHONE_AREA_CODE`, `PHONE_NUM`, `PHONE_NUM_EXT`, `TOLL_FREE_PHONE_NUM`, `FAX_NUM`, `LAST_NAME`, `FIRST_NAME`, `MIDDLE_NAME`, `PROVIDER_TYPE_CODE`, `PROVIDER_SEQ_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:177`

```csharp
// Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:177
authorize.BillingProvider = unitOfWork.GetRepository<ProviderLocation>().Query().SingleOrDefault(x => x.Id == authorization.BillingProviderId);

// Services/SAIF.Services/Claims/Bills/AuthorizationService.cs:257-259
unitOfWork.GetRepository<ProviderLocation>()
          .Query()
          .SingleOrDefault(x => x.Id == authorization.BillingProviderId)
```

## 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
  PL.PROVIDER_LOCATION_SEQ_NUM,
  PL.UPDATE_NUM,
  PL.BUSINESS_NAME,
  PL.PAYEE_NAME,
  PL.PRIMARY_LOCATION_FLAG,
  PL.BUSINESS_FLAG,
  PL.PHONE_AREA_CODE,
  PL.PHONE_NUM,
  PL.PHONE_NUM_EXT,
  PL.TOLL_FREE_PHONE_NUM,
  PL.FAX_NUM,
  PL.LAST_NAME,
  PL.FIRST_NAME,
  PL.MIDDLE_NAME,
  PL.PROVIDER_TYPE_CODE,
  PL.PROVIDER_SEQ_NUM
FROM PROVIDER_LOCATION PL
WHERE PL.PROVIDER_LOCATION_SEQ_NUM = :BillingProviderId
-- NHibernate expects at most one row
```

Translation notes:
- `Single`/`SingleOrDefault` → no row limit; NHibernate throws if more than one row is returned.
- `HasMany` collections (`Addresses`, `Identities`, `ProviderServices`) are lazy; `References(ProviderType)`/`References(Provider)` contribute FK columns only.

## Operations and processes
- AuthorizationService.CreateAuthorization — see [Operations and processes](../operations-processes.md)
- AuthorizationService.UpdateAuthorization — see [Operations and processes](../operations-processes.md)

## Business rules
- [SVC-BR-BIL-142 ClaimId NotNull - 'Error - Claim is required.'](../business-rules.md#svc-br-bil-142-claimid-notnull---'error---claim-is-required.')
- [SVC-BR-BIL-143 BillingProviderName NotNull - 'Error - Billing Provider is required.'](../business-rules.md#svc-br-bil-143-billingprovidername-notnull---'error---billing-provider-is-required.')

## Sources
- `Services/SAIF.Services/Claims/Bills/AuthorizationService.cs (L177, L257)`
