Skip to content

SQL-277: Retrieve ProviderLocation

This statement retrieves a single ProviderLocation by its identifier via NHibernate LINQ, used to resolve the servicing provider location for a bill service line in BillServiceService.CreateService and BillServiceService.UpdateService, executed from Services/SAIF.Services/Claims/Bills/BillServiceService.cs (L61, L135).

Classification

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

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A newService.ServicingProviderLocation.Id (L61) / updatedServiceLine.ServicingProviderLocation.Id (L135) — matched against PROVIDER_LOCATION_SEQ_NUM

Tables

Table Access Columns used
PROVIDER_LOCATION SELECT PROVIDER_LOCATION_SEQ_NUM, UPDATE_NUM, BUSINESS_NAME, PAYEE_NAME, PRIMARY_LOCATION_FLAG, BUSINESS_FLAG, PHONE_AREA_CODE, PHONE_NUM, PHONE_NUM_EXT, TOLL_FREE_PHONE_NUM, FAX_NUM, LAST_NAME, FIRST_NAME, MIDDLE_NAME, PROVIDER_TYPE_CODE, PROVIDER_SEQ_NUM

LINQ statement

Source: Services/SAIF.Services/Claims/Bills/BillServiceService.cs:60

// Services/SAIF.Services/Claims/Bills/BillServiceService.cs:60-61
newServiceLine.ServicingProviderLocation = newService.ServicingProviderLocation.IsNull()
    ? null : unitOfWork.GetRepository<ProviderLocation>().Query().FirstOrDefault(x => x.Id == newService.ServicingProviderLocation.Id);

// Services/SAIF.Services/Claims/Bills/BillServiceService.cs:134-135
dataServiceLine.ServicingProviderLocation = updatedServiceLine.ServicingProviderLocation.IsNull()
    ? null : unitOfWork.GetRepository<ProviderLocation>().Query().FirstOrDefault(x => x.Id == updatedServiceLine.ServicingProviderLocation.Id);

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
    PL.PROVIDER_LOCATION_SEQ_NUM,
    PL.UPDATE_NUM,
    PL.BUSINESS_NAME,
    PL.PAYEE_NAME,
    PL.PRIMARY_LOCATION_FLAG,
    PL.BUSINESS_FLAG,
    PL.PHONE_AREA_CODE,
    PL.PHONE_NUM,
    PL.PHONE_NUM_EXT,
    PL.TOLL_FREE_PHONE_NUM,
    PL.FAX_NUM,
    PL.LAST_NAME,
    PL.FIRST_NAME,
    PL.MIDDLE_NAME,
    PL.PROVIDER_TYPE_CODE,
    PL.PROVIDER_SEQ_NUM
  FROM PROVIDER_LOCATION PL
  WHERE PL.PROVIDER_LOCATION_SEQ_NUM = :Id
)
WHERE ROWNUM <= 1

Translation notes: - Runs only when the incoming ServicingProviderLocation is not null (C# ternary). - First/FirstOrDefault → Oracle10 dialect row limit SELECT * FROM (...) WHERE ROWNUM <= 1 (no ORDER BY, so the row returned is not deterministic if more than one matches). - HasMany collections (Addresses, Identities, ProviderServices) are lazy; References(ProviderType)/References(Provider) contribute FK columns only.

Operations and processes

Business rules

Sources

  • Services/SAIF.Services/Claims/Bills/BillServiceService.cs (L61, L135)