---
title: "SQL-323: Retrieve Task via TaskQuery (property)"
summary: Read operation against Task via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-323: Retrieve Task via TaskQuery (property)

This statement is the base `TASK` query exposed by the `TaskService.TaskQuery` property; it returns an unfiltered `IQueryable<Task>` that callers within `TaskService` compose further with their own predicates and terminal operators. The SQL is inferred from the NHibernate LINQ query and the `TaskMap` mapping shown below — it is not literal SQL text in the source code, and the base SELECT shown does not include any consumer-specific filtering.

## Classification

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [TASK](../database-tables.md#task) | SELECT | `TASK_SEQ_NUM`, `UPDATE_SEQ_NUM`, `TASK_DATE`, `TASK_TEXT`, `TASK_USER`, `NOTEPAD_FLAG`, `DELETE_FLAG`, `IMAGE_SEQ_NUM`, `CONTEXT_CODE`, `CONTEXT_KEY`, `CONTEXT_CATEGORY`, `CONTEXT_TEXT`, `CONTEXT_DATE`, `CONTEXT_NUM`, `CREATE_DATE`, `CREATE_USER`, `UPDATE_DATE`, `UPDATE_USER`, `TASK_SECURITY`, `CLAIM_ID`, `POLICY_NUM`, `TASK_ACTION_CODE`, `TASK_CATEGORY_CODE`, `TASK_PRIORITY_CODE`, `TASK_SOURCE_CODE`, `CLAIM_TASK_GROUP_CODE`, `LEGAL_NOTE_CATEGORY_CODE` |

## LINQ statement

Source: `Services/SAIF.Services/Claims/Tasks/TaskService.cs:69`

```csharp
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:65
protected IQueryable<TaskData.Task> TaskQuery
{
    get
    {
        return _unitOfWork.GetRepository<TaskData.Task>().Query();
    }
}
```

## 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
-- Base queryable returned by the TaskQuery property (no predicate of its own)
SELECT
  T.TASK_SEQ_NUM,
  T.UPDATE_SEQ_NUM,
  T.TASK_DATE,
  T.TASK_TEXT,
  T.TASK_USER,
  T.NOTEPAD_FLAG,
  T.DELETE_FLAG,
  T.IMAGE_SEQ_NUM,
  T.CONTEXT_CODE,
  T.CONTEXT_KEY,
  T.CONTEXT_CATEGORY,
  T.CONTEXT_TEXT,
  T.CONTEXT_DATE,
  T.CONTEXT_NUM,
  T.CREATE_DATE,
  T.CREATE_USER,
  T.UPDATE_DATE,
  T.UPDATE_USER,
  T.TASK_SECURITY,
  T.CLAIM_ID,
  T.POLICY_NUM,
  T.TASK_ACTION_CODE,
  T.TASK_CATEGORY_CODE,
  T.TASK_PRIORITY_CODE,
  T.TASK_SOURCE_CODE,
  T.CLAIM_TASK_GROUP_CODE,
  T.LEGAL_NOTE_CATEGORY_CODE
FROM TASK T
```

Translation notes:

- `TaskQuery` is a composition root: it returns `IQueryable<TaskData.Task>` and does not materialize. The SQL shown is the base entity SELECT only; every consumer in `TaskService` appends its own `Where`/`OrderBy`/terminal operator, and the statement actually executed is the base plus that consumer's predicates. A single concrete predicate set cannot be inferred for this SQL ID.

## Operations and processes
- TaskService.TaskQuery (property) — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Claims/Tasks/TaskService.cs (L69)`
