Skip to content

SQL-201: Retrieve HearingLocation via SetSubpoenaData

This statement loads a single HearingLocation record by its identifier so that SubpoenaSaveService.SetSubpoenaData can assign the hearing location on a subpoena. It is issued through NHibernate LINQ against the HearingLocation entity from Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:151.

Classification

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

Parameters

Parameter Direction Type Max length Description
:hearingLocationId Input long N/A subpoena.HearingLocation.Id, captured contract value

Tables

Table Access Columns used
HEARING_LOCATION SELECT HEARING_LOCATION_SEQ_NUM, LOCATION_NAME, ADDR1, ADDR2, ADDR3, CITY, STATE, ZIP, ZIP4, EFF_DATE, EXP_DATE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, HEARING_LOCATION_CODE

LINQ statement

Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:151

dataSubpoena.HearingLocation =
    _unitOfWork.GetRepository<LegalData.HearingLocation>()
        .Query().SingleOrDefault(x => x.Id == subpoena.HearingLocation.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 HL.HEARING_LOCATION_SEQ_NUM,
       HL.LOCATION_NAME,
       HL.ADDR1,
       HL.ADDR2,
       HL.ADDR3,
       HL.CITY,
       HL.STATE,
       HL.ZIP,
       HL.ZIP4,
       HL.EFF_DATE,
       HL.EXP_DATE,
       HL.CREATE_USER,
       HL.CREATE_DATE,
       HL.UPDATE_USER,
       HL.UPDATE_DATE,
       HL.HEARING_LOCATION_CODE
FROM   HEARING_LOCATION HL
WHERE  HL.HEARING_LOCATION_SEQ_NUM = :hearingLocationId;
-- NHibernate expects at most one row

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

Operations and processes

Sources

  • Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L152)