Skip to content

SQL-314: Retrieve SubpoenaStatus via SetNewSubpoenaStatus

This statement retrieves the SUBPOENA_STATUS_CODE row matching a caller-supplied status code via NHibernate LINQ over IUnitOfWork.GetRepository<SubpoenaStatus>(). It is executed by SubpoenaPaymentService.SetNewSubpoenaStatus (Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs (L340)) to resolve the target status before assigning it to a subpoena.

Classification

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

Parameters

Parameter Direction Type Max length Description
:toCode Input String N/A Status code (toCode) matched against CODE

Tables

Table Access Columns used
SUBPOENA_STATUS_CODE SELECT CODE, CODE_DESCR

LINQ statement

Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs:340

// Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs:340-342
subpoena.SubpoenaStatus = _unitOfWork.GetRepository<SubpoenaData.SubpoenaStatus>()
    .Query()
    .SingleOrDefault(x => x.Code == toCode);

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
  SSC.CODE,
  SSC.CODE_DESCR
FROM SUBPOENA_STATUS_CODE SSC
WHERE SSC.CODE = :toCode
-- NHibernate expects at most one row

Translation notes: - Single/SingleOrDefault → no row limit; NHibernate throws if more than one row is returned.

Operations and processes

Sources

  • Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs (L340)