Skip to content

SQL-237: WorkerQueryProvider.GetActiveSupportOrderCount

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

Classification

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

Parameters

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

Tables

Table Access Columns used
CL_CLAIM_SUPPORT_ORDER SELECT (COUNT) TERM_DATE, WORKER_ID

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:30.

// Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:30-31
return Factory.GetRepository<SupportOrder>().Query()
    .Count(x => !x.TerminationDate.HasValue && x.Worker.PersonId == workerId);

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 COUNT(*)
FROM CL_CLAIM_SUPPORT_ORDER CCSO
WHERE CCSO.TERM_DATE IS NULL
  AND CCSO.WORKER_ID = :workerId

Translation notes: - Not accessed: CL_CLAIM_PERSON — x.Worker.PersonId navigates to the identifier of ClaimPerson, so NHibernate short-circuits to the FK column CL_CLAIM_SUPPORT_ORDER.WORKER_ID (References(x => x.Worker).Column("WORKER_ID")); no join is issued. - !x.TerminationDate.HasValue → TERM_DATE IS NULL. - Count(predicate) is a terminal aggregate; no entity columns are selected.

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:30