Skip to content

SQL-138: EbillServiceQueryProvider.GetMaximumServiceDate

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

Classification

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

Parameters

Parameter Direction Type Max length Description
ebill Input Ebill N/A Method argument of EbillServiceQueryProvider.GetMaximumServiceDate bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
EBILL_SERVICE SELECT (aggregate, two statements) BILL_SERVICE_DATE, EBILL_SEQ_NUM, BILL_SERVICE_END_DATE

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/Ebilling/EbillServiceQueryProvider.cs:25

// Data/SAIF.Data/Queries/Claims/Ebilling/EbillServiceQueryProvider.cs:18
repository = Factory.GetRepository<EbillService>().Query();

// Data/SAIF.Data/Queries/Claims/Ebilling/EbillServiceQueryProvider.cs:25
var maxServiceFrom = repository.Where(x => x.Bill.Id == ebill.Id).Max(x => x.ServiceDate);
var maxServiceThru = repository.Where(x => x.Bill.Id == ebill.Id).Max(x => x.ServiceEndDate);

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
-- Statement 1 (L25): Max(x => x.ServiceDate)
SELECT MAX(ES.BILL_SERVICE_DATE)
FROM EBILL_SERVICE ES
WHERE ES.EBILL_SEQ_NUM = :ebillId

-- Statement 2 (L26): Max(x => x.ServiceEndDate)
SELECT MAX(ES.BILL_SERVICE_END_DATE)
FROM EBILL_SERVICE ES
WHERE ES.EBILL_SEQ_NUM = :ebillId

Translation notes: - These are two separate round trips, one per Max() terminal operator.

Operations and processes

Sources

  • Data/SAIF.Data/Queries/Claims/Ebilling/EbillServiceQueryProvider.cs:25