SQL-197: PolicyQueryProvider.GetBusiness¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by PolicyQueryProvider.GetBusiness.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-197 |
| 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 | GetBusiness |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
policyNumber |
Input | long | N/A | Method argument of PolicyQueryProvider.GetBusiness bound into the ORM expression; NHibernate generates the bind variable at runtime |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| BUSINESS | SELECT | POLICY_NUM, BUS_SEQ_NUM, BUS_EFF_DATE, BUS_EXP_DATE, FEID_NUM, PRIMARY_BUS_FLAG |
LINQ statement¶
Source: Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:44-45.
public Business GetBusiness(long policyNumber)
{
return Factory.GetRepository<Business>().Query()
.SingleOrDefault((x => x.PolicyNumber == policyNumber && x.IsPrimaryBusiness));
}
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
B.POLICY_NUM,
B.BUS_SEQ_NUM,
B.BUS_EFF_DATE,
B.BUS_EXP_DATE,
B.FEID_NUM,
B.PRIMARY_BUS_FLAG
FROM BUSINESS B
WHERE B.POLICY_NUM = :policyNumber
AND B.PRIMARY_BUS_FLAG = 'Y'
-- SingleOrDefault: NHibernate expects at most one row
Translation notes:
- IsPrimaryBusiness → PRIMARY_BUS_FLAG, CustomType<YesNoType>() (BusinessMap.cs:20) → 'Y'.
Operations and processes¶
Sources¶
Data/SAIF.Data/Queries/Policies/PolicyQueryProvider.cs:44