SQL-182: OutputDocumentQueryProvider.GetAccountNumber¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by OutputDocumentQueryProvider.GetAccountNumber.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-182 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | OutputDocumentQueryProvider |
| Criteria property | N/A — ORM |
| Lifecycle method | GetAccountNumber |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
policyNumber |
Input | long | N/A | Method argument of OutputDocumentQueryProvider.GetAccountNumber bound into the ORM expression; NHibernate generates the bind variable at runtime |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| POLICY | SELECT | POLICY_NUM, POLICY_NAME, LEGAL_NAME, SECURE_POLICY_CODE, OFFICE_CODE, ACCOUNT_NUM, POLICY_STATUS_CODE, MARKET_TYPE_CODE, POLICY_RELATIONSHIP_POLICY_NUM, POLICY_RELATIONSHIP_CODE, customer_service_team_code, ENTITY_CODE, TRADING_SEQ_NUM, RATE_ACCOUNT, AGENT_NUM |
LINQ statement¶
Source: Data/SAIF.Data/Queries/OutputDocuments/OutputDocumentQueryProvider.cs:35-36.
public string GetAccountNumber(long policyNumber)
{
return Factory.GetRepository<Policy>()
.Query().FirstOrDefault(p => p.PolicyNumber == policyNumber)?.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 * FROM (
SELECT
P.POLICY_NUM,
P.POLICY_NAME,
P.LEGAL_NAME,
P.SECURE_POLICY_CODE,
P.OFFICE_CODE,
P.ACCOUNT_NUM,
P.POLICY_STATUS_CODE,
P.MARKET_TYPE_CODE,
P.POLICY_RELATIONSHIP_POLICY_NUM,
P.POLICY_RELATIONSHIP_CODE,
P.customer_service_team_code,
P.ENTITY_CODE,
P.TRADING_SEQ_NUM,
P.RATE_ACCOUNT,
P.AGENT_NUM
FROM POLICY P
WHERE P.POLICY_NUM = :policyNumber
) WHERE ROWNUM <= 1
Translation notes:
- There is no Select projection. FirstOrDefault materializes the entire Policy entity, and ?.AccountNumber (ACCOUNT_NUM) is read in memory.
- OFFICE_CODE is mapped both as a property and as the References(Office) FK; it is selected once.
Operations and processes¶
Business rules¶
- SD-BR-070 Output document status code set
- SD-BR-071 Document date defaults from batch process log
- SD-BR-075 Child documents only retrievable for a released parent
Sources¶
Data/SAIF.Data/Queries/OutputDocuments/OutputDocumentQueryProvider.cs:35