Skip to content

SQL-191: Retrieve EmployerLiabilityLimit via GetStandardLimits

This statement retrieves a single EmployerLiabilityLimit record by code, called from CertificateInformationService.GetStandardLimits with a code taken from an in-memory EmployerLiabilityFactors object produced by SQL-189.

Classification

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

Parameters

Parameter Direction Type Max length Description
:limitCode Input String N/A limitCode.Code, captured from an in-memory object — filters EMP_LIAB_STAT_CODE

Tables

Table Access Columns used
EMPLOYERS_LIABILITY_LIMITS SELECT EMP_LIAB_STAT_CODE, EMP_LIAB_LIMIT1, EMP_LIAB_LIMIT2, EMP_LIAB_LIMIT3, STANDARD_LIMITS_FLAG; filter EMP_LIAB_STAT_CODE

LINQ statement

Source: Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs:483

return unitOfWork.GetRepository<EmployerLiabilityLimit>()
    .Query().SingleOrDefault(ell => ell.Code == limitCode.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 ELL.EMP_LIAB_STAT_CODE,
       ELL.EMP_LIAB_LIMIT1,
       ELL.EMP_LIAB_LIMIT2,
       ELL.EMP_LIAB_LIMIT3,
       ELL.STANDARD_LIMITS_FLAG
FROM   Employers_Liability_Limits ELL
WHERE  ELL.EMP_LIAB_STAT_CODE = :limitCode   -- :limitCode = limitCode.Code (captured)
-- NHibernate expects at most one row

Translation notes: - SingleOrDefault/Single add no row limit; NHibernate throws if more than one row is returned. - employers_liability_factors is not accessed by this statement: limitCode is an in-memory object from the SQL-189 list, and limitCode.Code is evaluated client-side (throws NullReferenceException if limitCode is null — see the source //todo at L482).

Operations and processes

Sources

  • Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs (L483)