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

# SQL-333: Retrieve TaskPriority via SetCommonPropteryValues

This ORM statement performs a read operation on `TaskPriority`, retrieving the single row where `Code = 'MED'`, via `IUnitOfWork.GetRepository<T>()`, executed from `Services/SAIF.Services/Collections/GenerateTasksService.cs (L263)`. The SQL below is inferred from the LINQ expression and the `TaskPriority` NHibernate mapping (`TASK_PRIORITY_CODE`); it is not literal SQL text present in source.

## Classification

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

## Tables

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

## LINQ statement

Source: `Services/SAIF.Services/Collections/GenerateTasksService.cs:263`

```csharp
// Services/SAIF.Services/Collections/GenerateTasksService.cs:262
inTask.TaskPriority =
    UnitOfWork.GetRepository<TaskDataModel.TaskPriority>().Query().SingleOrDefault(x => x.Code == "MED");
```

## 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
  TPC.Code,
  TPC.CODE_DESCR
FROM TASK_PRIORITY_CODE TPC
WHERE TPC.Code = 'MED'
-- NHibernate expects at most one row
```

Translation notes:

- `SingleOrDefault` -> no row limit; NHibernate expects at most one row.

## Operations and processes
- GenerateTasksService.SetCommonPropteryValues — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Collections/GenerateTasksService.cs (L263)`
