Skip to content

SQL-239: Retrieve OtherStatesPolicy via GetOscPolicyById

This ORM statement retrieves a single OtherStatesPolicy (an other-states-coverage policy) by its primary key, via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs (L39).

Classification

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

Parameters

Parameter Direction Type Max length Description
:oscPolicyId Input long N/A Primary key of the OtherStatesPolicy to retrieve

Tables

Table Access Columns used
OSC_POLICY_VIEW SELECT OSC_POLICY_SEQ_NUM, OSC_LEGAL_NAME, OSC_POLICY_NUM, cancel_date, POLICY_STATUS_CODE, POLICY_NUM, AGENT_NUM

LINQ statement

Source: Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs:39

// Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs:39-40
return unitOfWork.GetRepository<OtherStatesPolicy>()
    .Query().Single(p => p.Id == oscPolicyId);

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
  OPV.OSC_POLICY_SEQ_NUM,
  OPV.OSC_LEGAL_NAME,
  OPV.OSC_POLICY_NUM,
  OPV.cancel_date,
  OPV.POLICY_STATUS_CODE,
  OPV.POLICY_NUM,
  OPV.AGENT_NUM
FROM OSC_POLICY_VIEW OPV
WHERE OPV.OSC_POLICY_SEQ_NUM = :oscPolicyId
-- NHibernate expects at most one row

Translation notes: - Single(...) throws when no row or more than one row is returned; no row limit is applied. - HasMany(Periods) is lazy and not selected.

Operations and processes

Sources

  • Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationDataHelper.cs (L39)