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

# SQL-200: Retrieve HearingLocation via InitializeLabel

This statement looks up the SAIF Corporation hearing-location record by its location name so that `SubpoenaLabelService.InitializeLabel` can build the mailing label. It is issued through NHibernate LINQ against the `HearingLocation` entity from `Services/SAIF.Services/Legal/Subpoenas/SubpoenaLabelService.cs:345`.

## Classification

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

## Parameters

**Parameters:** None (constant). `LOCATION_NAME` is filtered against the literal `'SAIF Corporation'` (the `SaifLocation` const, `SubpoenaLabelService.cs:24`).

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [HEARING_LOCATION](../database-tables.md#hearing_location) | SELECT | HEARING_LOCATION_SEQ_NUM, LOCATION_NAME, ADDR1, ADDR2, ADDR3, CITY, STATE, ZIP, ZIP4, EFF_DATE, EXP_DATE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, HEARING_LOCATION_CODE |

## LINQ statement

Source: `Services/SAIF.Services/Legal/Subpoenas/SubpoenaLabelService.cs:345`

```csharp
var saifAddress =
    _unitOfWork.GetRepository<HearingLocation>().Query().FirstOrDefault(x => x.LocationName == SaifLocation);
```

## 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 * FROM (
    SELECT HL.HEARING_LOCATION_SEQ_NUM,
       HL.LOCATION_NAME,
       HL.ADDR1,
       HL.ADDR2,
       HL.ADDR3,
       HL.CITY,
       HL.STATE,
       HL.ZIP,
       HL.ZIP4,
       HL.EFF_DATE,
       HL.EXP_DATE,
       HL.CREATE_USER,
       HL.CREATE_DATE,
       HL.UPDATE_USER,
       HL.UPDATE_DATE,
       HL.HEARING_LOCATION_CODE
    FROM   HEARING_LOCATION HL
    WHERE  HL.LOCATION_NAME = 'SAIF Corporation'     -- SaifLocation const (SubpoenaLabelService.cs:24)
) WHERE ROWNUM <= 1;
```

Translation notes:
- `FirstOrDefault` → Oracle10 dialect wraps the query in `SELECT * FROM (...) WHERE ROWNUM <= 1`.
- `LocationName == <const>`: C# `const` values are shown as literals for readability; NHibernate LINQ sends them as bind parameters.

## Operations and processes
- SubpoenaLabelService.InitializeLabel — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Legal/Subpoenas/SubpoenaLabelService.cs (L346)`
