Skip to content

SQL-195: PolicyQueryProvider.GetNonPolicyAccount

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

Classification

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

Parameters

Parameter Direction Type Max length Description
accountNumber Input long N/A Method argument of PolicyQueryProvider.GetNonPolicyAccount bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
NON_EMPR_ACCT SELECT ACCT_NUM, ACCT_NAM, ADDR_LINE1, CITY_NAM, STATE_CD, ZIP_CD, ZIP_CD_EXT, PHONE_NUM, UPDT_TS, UPDR_ID, UPDT_SEQ_NUM

LINQ statement

Source: Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:31-32.

public NonEmployerAccount GetNonPolicyAccount(long accountNumber)
{
    return Factory.GetRepository<NonEmployerAccount>().Query()
        .SingleOrDefault(x => x.AccountNumber == accountNumber);
}

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
  NEA.ACCT_NUM,
  NEA.ACCT_NAM,
  NEA.ADDR_LINE1,
  NEA.CITY_NAM,
  NEA.STATE_CD,
  NEA.ZIP_CD,
  NEA.ZIP_CD_EXT,
  NEA.PHONE_NUM,
  NEA.UPDT_TS,
  NEA.UPDR_ID,
  NEA.UPDT_SEQ_NUM
FROM NON_EMPR_ACCT NEA
WHERE NEA.ACCT_NUM = :accountNumber
-- SingleOrDefault: NHibernate expects at most one row

Translation notes: - AccountNumber is the Id (NonEmployerAccountMap.cs:13). - Mapping quirk: both AddressLine1 and AddressLine2 map to ADDR_LINE1. The column is selected once and both properties receive the same value. Record this as a mapping defect, not a translation choice.

Operations and processes

Sources

  • Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:31