Skip to content

SQL-196: PolicyQueryProvider.GetPolicyTeamFunction

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

Classification

Field Value
SQL ID SQL-196
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 GetPolicyTeamFunction

Parameters

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

Tables

Table Access Columns used
POLICY_TEAM_FUNCTION SELECT POLICY_NUM, TEAM_FUNCTION_CODE, UPDATE_DATE, UPDATE_USER, USER_NAME

LINQ statement

Source: Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:37-39.

public PolicyTeamFunction GetPolicyTeamFunction(long policyNumber, string teamFunctionCode)
{
    return Factory.GetRepository<PolicyTeamFunction>().Query()
        .SingleOrDefault(t => t.PolicyNumber == policyNumber 
        && t.TeamFunctionCode == teamFunctionCode);
}

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
  PTF.POLICY_NUM,
  PTF.TEAM_FUNCTION_CODE,
  PTF.UPDATE_DATE,
  PTF.UPDATE_USER,
  PTF.USER_NAME
FROM POLICY_TEAM_FUNCTION PTF
WHERE PTF.POLICY_NUM = :policyNumber
  AND PTF.TEAM_FUNCTION_CODE = :teamFunctionCode
-- SingleOrDefault: NHibernate expects at most one row

Translation notes: - Composite key POLICY_NUM + TEAM_FUNCTION_CODE (PolicyTeamFunctionMap.cs:12-14). USER_NAME is the FK of the lazy WcisEmployee reference, which is not joined.

Operations and processes

Sources

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