SQL-331: Retrieve TaskGroup¶
This statement retrieves CLAIM_TASK_GROUP_CODE records for TaskService, in two shapes: GetTaskGroups returns the full list, and CreateTaskStateless/CreateTask/UpdateTask/ReassignTasks look up a single task group by code (skipped when the code is NULL). The SQL is inferred from the NHibernate LINQ queries and the TaskGroup class map shown below — it is not literal SQL text in the source code.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-331 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | TaskGroup |
| Criteria property | N/A — ORM |
| Lifecycle method | CreateTask, CreateTaskStateless, GetTaskGroups, ReassignTasks, UpdateTask |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Code |
Input | string | N/A | taskEdit.TaskGroup.Code (line 528), task.TaskGroup.Code (line 614), taskCopy.TaskGroup.Code (line 690); at line 863 the bound value is the method argument newGroup. |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| CLAIM_TASK_GROUP_CODE | SELECT | Code, UPDATE_NUM, CODE_DESCR, UPDATE_DATE, UPDATE_USER |
LINQ statement¶
Source: Services/SAIF.Services/Claims/Tasks/TaskService.cs:146
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:146
return Mapper.Map<TaskGroup[]>(_unitOfWork.GetRepository<TaskData.TaskGroup>().Query());
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:528
newTask.TaskGroup = taskEdit.TaskGroup.Code == "NULL" ? null : _unitOfWork.GetRepository<TaskData.TaskGroup>().Query().SingleOrDefault(x => x.Code == taskEdit.TaskGroup.Code);
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:614
taskData.TaskGroup = task.TaskGroup.Code == "NULL" ? null : _unitOfWork.GetRepository<TaskData.TaskGroup>().Query().SingleOrDefault(x => x.Code == task.TaskGroup.Code);
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:690
taskData.TaskGroup = task.TaskGroup.Code == "NULL" ? null : _unitOfWork.GetRepository<TaskData.TaskGroup>().Query().SingleOrDefault(x => x.Code == taskCopy.TaskGroup.Code);
// Services/SAIF.Services/Claims/Tasks/TaskService.cs:863
: _unitOfWork.GetRepository<TaskData.TaskGroup>().Query().SingleOrDefault(x => x.Code == newGroup);
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.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
-- TaskService.GetTaskGroups (line 146): enumerated by Mapper.Map
SELECT
CTGC.Code,
CTGC.UPDATE_NUM,
CTGC.CODE_DESCR,
CTGC.UPDATE_DATE,
CTGC.UPDATE_USER
FROM CLAIM_TASK_GROUP_CODE CTGC
-- TaskService.CreateTaskStateless (528), CreateTask (614), UpdateTask (690), ReassignTasks (863)
SELECT
CTGC.Code,
CTGC.UPDATE_NUM,
CTGC.CODE_DESCR,
CTGC.UPDATE_DATE,
CTGC.UPDATE_USER
FROM CLAIM_TASK_GROUP_CODE CTGC
WHERE CTGC.Code = :Code
-- NHibernate expects at most one row
Translation notes:
- Two shapes share this SQL ID. The single-row lookups are skipped client-side when the code is
"NULL"(ternaries at 528/614/690/861).
Operations and processes¶
- TaskService.CreateTask — see Operations and processes
- TaskService.CreateTaskStateless — see Operations and processes
- TaskService.GetTaskGroups — see Operations and processes
- TaskService.ReassignTasks — see Operations and processes
- TaskService.UpdateTask — see Operations and processes
Business rules¶
Sources¶
Services/SAIF.Services/Claims/Tasks/TaskService.cs (L146, L528, L614, L690, L863)