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

# SQL-342: Retrieve TradingAs via GetTradingAsById

This ORM statement performs a read operation on `TradingAs`, retrieving exactly one row where `Id` matches, via `IUnitOfWork.GetRepository<T>()`, executed from `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs (L32)`. The SQL below is inferred from the LINQ expression and the `TradingAs` NHibernate mapping (`TRADING_AS`); it is not literal SQL text present in source.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:tradingAsId` | Input | long | N/A | Method argument of `GetTradingAsById` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [TRADING_AS](../database-tables.md#trading_as) | SELECT | `TRADING_SEQ_NUM`, `TRADING_AS_NAME`, `TRADING_AS_NAME_EFF_DATE`, `TRADING_AS_CANCEL_DATE`, `POLICY_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs:32`

```csharp
// Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs:32
return unitOfWork.GetRepository<TradingAs>()
    .Query().Single(ta => ta.Id == tradingAsId);
```

## 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
  TA.TRADING_SEQ_NUM,
  TA.TRADING_AS_NAME,
  TA.TRADING_AS_NAME_EFF_DATE,
  TA.TRADING_AS_CANCEL_DATE,
  TA.POLICY_NUM
FROM TRADING_AS TA
WHERE TA.TRADING_SEQ_NUM = :tradingAsId
-- NHibernate expects at most one row
```

Translation notes:

- `Single` -> no row limit; NHibernate expects exactly one row.
- `References(Policy).Column("POLICY_NUM")` contributes the FK column only; no join.

## Operations and processes
- CertificateInformationDataHelper.GetTradingAsById — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs (L32)`
