Skip to content

SQL-052: CertificateHolderQueryProvider.GetCertificateHolders

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by CertificateHolderQueryProvider.GetCertificateHolders.

Classification

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

Parameters

Parameter Direction Type Max length Description
policyNumber Input long N/A Method argument of CertificateHolderQueryProvider.GetCertificateHolders bound into the ORM expression; NHibernate generates the bind variable at runtime
includeExpired Input bool N/A Method argument of CertificateHolderQueryProvider.GetCertificateHolders bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
CERTIFICATE_HOLDER SELECT CERT_HOLD_SEQ_NUM, POLICY_NUM, CERT_HOLD_NAME1, CERT_HOLD_NAME2, EXPIRED_FLAG, SUPERSEDED_FLAG, CERT_HOLD_ADDR1, CERT_HOLD_ADDR2, CERT_HOLD_ADDR3, CERT_HOLD_CITY, CERT_HOLD_STATE, CERT_HOLD_COUNTRY, CERT_HOLD_ZIP, CERT_HOLD_ZIP4, FOREIGN_ADDRESS_FLAG, CERT_HOLD_PHONE, CERT_HOLD_FAX, CERT_HOLD_EMAIL, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, SUPERSEDED_BY_CERT_HOLD_SEQNUM

LINQ statement

Source: Data/SAIF.Data/Queries/Policies/Certificates/CertificateHolderProvider.cs:26. The repository is a class field initialised from Factory.GetRepository<CertificateHolder>().Query() at Data/SAIF.Data/Queries/Policies/Certificates/CertificateHolderProvider.cs:16.

return repository.Where(c => c.PolicyNumber == policyNumber && !c.IsSuperseded && (includeExpired || c.IsExpired == includeExpired)).ToList();

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
  CH.CERT_HOLD_SEQ_NUM,
  CH.POLICY_NUM,
  CH.CERT_HOLD_NAME1,
  CH.CERT_HOLD_NAME2,
  CH.EXPIRED_FLAG,
  CH.SUPERSEDED_FLAG,
  CH.CERT_HOLD_ADDR1,
  CH.CERT_HOLD_ADDR2,
  CH.CERT_HOLD_ADDR3,
  CH.CERT_HOLD_CITY,
  CH.CERT_HOLD_STATE,
  CH.CERT_HOLD_COUNTRY,
  CH.CERT_HOLD_ZIP,
  CH.CERT_HOLD_ZIP4,
  CH.FOREIGN_ADDRESS_FLAG,
  CH.CERT_HOLD_PHONE,
  CH.CERT_HOLD_FAX,
  CH.CERT_HOLD_EMAIL,
  CH.CREATE_USER,
  CH.CREATE_DATE,
  CH.UPDATE_USER,
  CH.UPDATE_DATE,
  CH.SUPERSEDED_BY_CERT_HOLD_SEQNUM
FROM CERTIFICATE_HOLDER CH
WHERE CH.POLICY_NUM = :policyNumber
  AND CH.SUPERSEDED_FLAG = 'N'
  AND (:includeExpired = 1 OR CH.EXPIRED_FLAG = :includeExpiredYN)

Translation notes: - :includeExpired is the captured boolean rendered as a numeric test; :includeExpiredYN is the same value bound through YesNoType as 'Y'/'N' for the EXPIRED_FLAG comparison. - With includeExpired = true, all non-superseded rows are returned. With false, only EXPIRED_FLAG = 'N' rows are returned. NHibernate may constant-fold the captured bool.

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Policies/Certificates/CertificateHolderProvider.cs:26