SQL-199: Retrieve HearingLocation via SetAttorneyInfo¶
This statement looks up the SAIF Corporation hearing-location record by its location name so that SubpoenaDocumentService.SetAttorneyInfo can format the return address for a subpoena document. It is issued through NHibernate LINQ against the HearingLocation entity from Services/SAIF.Services/Legal/Subpoenas/SubpoenaDocumentService.cs:617.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-199 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | SubpoenaDocumentService |
| Criteria property | N/A — ORM |
| Lifecycle method | SetAttorneyInfo |
Parameters¶
Parameters: None (constant). LOCATION_NAME is filtered against the literal 'SAIF Corporation' (the ReturnAddress const, SubpoenaDocumentService.cs:39).
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/SubpoenaDocumentService.cs:617
var attorneyAddress = FormatHearingAddress(_unitOfWork.GetRepository<HearingLocation>().Query()
.FirstOrDefault(x => x.LocationName == ReturnAddress));
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 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.LOCATION_NAME = 'SAIF Corporation' -- ReturnAddress const (SubpoenaDocumentService.cs:39)
) WHERE ROWNUM <= 1;
Translation notes:
- FirstOrDefault → Oracle10 dialect wraps the query in SELECT * FROM (...) WHERE ROWNUM <= 1.
- LocationName == <const>: C# const values are shown as literals for readability; NHibernate LINQ sends them as bind parameters.
- FormatHearingAddress formats the entity in memory.
Operations and processes¶
- SubpoenaDocumentService.SetAttorneyInfo — see Operations and processes
Sources¶
Services/SAIF.Services/Legal/Subpoenas/SubpoenaDocumentService.cs (L617)