Skip to content

SQL-203: Retrieve HostileWorkerCode via CreateOverride

This statement looks up a hostile-worker code by its code value so that SecurityOverrideService.CreateOverride can populate the HostileWorker reference on a new security override. It is issued through NHibernate LINQ against the HostileWorkerCode entity from Services/SAIF.Services/Claims/SecurityOverride/SecurityOverrideService.cs:112.

Classification

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

Parameters

Parameter Direction Type Max length Description
:hostileWorkerCode Input string N/A claimData.Worker.HostileWorker.Code, captured

Tables

Table Access Columns used
CL_HOSTILE_WORKER_CODE SELECT CODE, CODE_DESCR, UPDATE_DATE, UPDATE_NUM, UPDATE_USER

LINQ statement

Source: Services/SAIF.Services/Claims/SecurityOverride/SecurityOverrideService.cs:112

HostileWorker = unitOfWork.GetRepository<Data.Model.Claims.CodeTables.HostileWorkerCode>()
        .Query()
        .SingleOrDefault(x => x.Code == claimData.Worker.HostileWorker.Code),

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
SELECT HW.CODE,
       HW.CODE_DESCR,
       HW.UPDATE_DATE,
       HW.UPDATE_NUM,
       HW.UPDATE_USER
FROM   CL_HOSTILE_WORKER_CODE HW
WHERE  HW.CODE = :hostileWorkerCode;
-- NHibernate expects at most one row

Translation notes: - SingleOrDefault/Single add no row limit; NHibernate throws if more than one row is returned. - Fragment is an object-initializer member (HostileWorker = ...) inside the new SecurityOverride { ... } begun at L104.

Operations and processes

Sources

  • Services/SAIF.Services/Claims/SecurityOverride/SecurityOverrideService.cs (L112)