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

# SQL-216: Retrieve JudgmentYearsValue via GetJudgmentYears

This statement retrieves every judgment-years value, ordered by number of years, so that `CollectionsService.GetJudgmentYears` can populate a value list. It is issued through NHibernate LINQ against the `JudgmentYearsValue` entity from `Services/SAIF.Services/Collections/CollectionsService.cs:1087`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-216 |
| **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** | `GetJudgmentYears` |

## Parameters

**Parameters:** None.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [JUDGEMENT_YEARS_VALUE](../database-tables.md#judgement_years_value) | SELECT | NUMBER_OF_YEARS_VALUE |

## LINQ statement

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

```csharp
return Mapper.Map<JudgmentYearsValue[]>(UnitOfWork.GetRepository<DataModel.JudgmentYearsValue>()
    .Query().OrderBy(x => x.NumberOfYears).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 JY.NUMBER_OF_YEARS_VALUE
FROM   JUDGEMENT_YEARS_VALUE JY
ORDER BY JY.NUMBER_OF_YEARS_VALUE;
```

Translation notes:
- The table name is spelled `JUDGEMENT_YEARS_VALUE` in the mapping (the entity name is spelled "Judgment").

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

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