Skip to content

SQL-099: EbillDocumentQueryProvider.GetDocumentOverride

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

Classification

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

Parameters

Parameter Direction Type Max length Description
ebillDocumentTypeCode Input string N/A Method argument of EbillDocumentQueryProvider.GetDocumentOverride bound into the ORM expression; NHibernate generates the bind variable at runtime
providerTypeCode Input string N/A Method argument of EbillDocumentQueryProvider.GetDocumentOverride bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
EBILL_DOCUMENT_OVERRIDE SELECT ebill_document_type_code, provider_type_code, update_num, update_date, update_user, OB_DOC_TYPE_SEQ_NUM, OB_DOC_SUB_TYPE_SEQ_NUM, OB_DOC_TYPE_GROUP_SEQ_NUM

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/Ebilling/EbillDocumentQueryProvider.cs:64

// Data/SAIF.Data/Queries/Claims/Ebilling/EbillDocumentQueryProvider.cs:64
return Factory.GetRepository<EbillDocumentOverride>().Query()
    .FirstOrDefault(x => x.EbillDocumentTypeCode.ToLower() == ebillDocumentTypeCode.ToLower()
        && x.ProviderTypeCode.ToLower() == providerTypeCode.ToLower());

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
    EDO.ebill_document_type_code,
    EDO.provider_type_code,
    EDO.update_num,
    EDO.update_date,
    EDO.update_user,
    EDO.OB_DOC_TYPE_SEQ_NUM,
    EDO.OB_DOC_SUB_TYPE_SEQ_NUM,
    EDO.OB_DOC_TYPE_GROUP_SEQ_NUM
  FROM EBILL_DOCUMENT_OVERRIDE EDO
  WHERE LOWER(EDO.ebill_document_type_code) = :ebillDocumentTypeCode
    AND LOWER(EDO.provider_type_code) = :providerTypeCode
)
WHERE ROWNUM <= 1

Translation notes:

  • Oracle10 row limit for FirstOrDefault(): the query (including any ORDER BY) is wrapped in ROWNUM <= 1 (limit written inline; NHibernate binds it as a parameter at runtime).
  • The repository is obtained inline at the call site (Factory.GetRepository<EbillDocumentOverride>().Query(), L64), not from a field.
  • x.EbillDocumentTypeCode.ToLower() and x.ProviderTypeCode.ToLower() translate to LOWER(col). The argument-side .ToLower() calls do not depend on the lambda parameter, so NHibernate's partial evaluator runs them in memory and binds the lower-cased values.
  • Column names are written in the case declared by the mapping (lower case for the composite key and audit columns, upper case for the OnBase references). Oracle treats them case-insensitively.

Operations and processes

Sources

  • Data/SAIF.Data/Queries/Claims/Ebilling/EbillDocumentQueryProvider.cs:64