Skip to content

SQL-227: ServiceCodeMaintenanceQueryProvider.GetFeeSchedules

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

Classification

Field Value
SQL ID SQL-227
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Unknown**
Schema Unknown**
Command type N/A (ORM-generated)
Business object ServiceCodeMaintenanceQueryProvider
Criteria property N/A — ORM
Lifecycle method GetFeeSchedules

Parameters

Parameter Direction Type Max length Description
code Input string N/A Method argument of ServiceCodeMaintenanceQueryProvider.GetFeeSchedules bound into the ORM expression; NHibernate generates the bind variable at runtime
type Input string N/A Method argument of ServiceCodeMaintenanceQueryProvider.GetFeeSchedules bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
CBP_SERVICE_FEE SELECT CBP_SERVICE_CODE, SERVICE_TYPE_CODE, SERVICE_CONVERSION_CODE, EFF_DATE, EXP_DATE, MAX_AMT, FACILITY_RELATIVE_QTY, NON_FACILITY_RELATIVE_QTY, UPDATE_USER, UPDATE_NUM, UPDATE_DATE, PERCENT_OFF_FLAG, PACKAGE_FLAG

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/Bills/ServiceCodeMaintenanceQueryProvider.cs:32.

public IEnumerable<CbpServiceFee> GetFeeSchedules(string code, string type)
{
    return Factory.GetRepository<CbpServiceFee>().Query().Where(x => x.CbpService.Code == code && x.CbpService.ServiceType.Code == type).ToList();
}

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
  CSF.CBP_SERVICE_CODE,
  CSF.SERVICE_TYPE_CODE,
  CSF.SERVICE_CONVERSION_CODE,
  CSF.EFF_DATE,
  CSF.EXP_DATE,
  CSF.MAX_AMT,
  CSF.FACILITY_RELATIVE_QTY,
  CSF.NON_FACILITY_RELATIVE_QTY,
  CSF.UPDATE_USER,
  CSF.UPDATE_NUM,
  CSF.UPDATE_DATE,
  CSF.PERCENT_OFF_FLAG,
  CSF.PACKAGE_FLAG
FROM CBP_SERVICE_FEE CSF
WHERE CSF.CBP_SERVICE_CODE = :code
  AND CSF.SERVICE_TYPE_CODE = :type

Translation notes: - Mapping inconsistency. KeyReference(x => x.CbpService, "CBP_SERVICE_CODE", "SERVICE_TYPE_CODE", "SERVICE_CONVERSION_CODE") (CbpServiceFeeMap.cs:15) declares 3 columns, but the target CbpServiceCode (CbpServiceFee.cs:12) has a 2-column composite id (CODE, BILL_SERVICE_TYPE_CODE). NHibernate normally rejects a column-count mismatch when building the session factory. The translation assumes the first two columns align positionally with Code/ServiceType.Code. - SERVICE_CONVERSION_CODE is also mapped as a plain property (line 19); it is selected once. - CbpServiceFee.CbpService/CbpServiceType are declared non-virtual (CbpServiceFee.cs:12-13), which NHibernate lazy proxies do not support. This is noted as a mapping risk only.

Operations and processes

Sources

  • Data/SAIF.Data/Queries/Claims/Bills/ServiceCodeMaintenanceQueryProvider.cs:32