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

# SQL-215: Retrieve JudgmentCode via GetJudgmentCodes

This statement retrieves every judgment code, ordered by description, so that `CollectionsService.GetJudgmentCodes` can populate a code list. It is issued through NHibernate LINQ against the `JudgmentCode` entity from `Services/SAIF.Services/Collections/CollectionsService.cs:1082`.

## Classification

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

## Parameters

**Parameters:** None.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [JUDGMENT_CODE](../database-tables.md#judgment_code) | SELECT | Code, CODE_DESCR |

## LINQ statement

Source: `Services/SAIF.Services/Collections/CollectionsService.cs:1082`

```csharp
return Mapper.Map<JudgmentCode[]>(UnitOfWork.GetRepository<DataModel.JudgmentCode>()
    .Query().OrderBy(x => x.Description).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 JC.Code,
       JC.CODE_DESCR
FROM   JUDGMENT_CODE JC
ORDER BY JC.CODE_DESCR;
```

Translation notes:
- `Id(x => x.Code)` has no `.Column(...)`, so the default column name `Code` is used.

## Operations and processes
- CollectionsService.GetJudgmentCodes — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Collections/CollectionsService.cs (L1082)`
