Skip to content

SQL-169: Retrieve DocumentTemplateOption

This statement reads DOCUMENT_TEMPLATE_OPTION rows either unfiltered (GetAllTemplateOptions) or filtered to a single template (GetOptionsForOneTemplate, GetDocumentSqlLines).

Classification

Field Value
SQL ID SQL-169
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object DocumentTemplateOption
Criteria property N/A — ORM
Lifecycle method GetAllTemplateOptions, GetDocumentSqlLines, GetOptionsForOneTemplate

Parameters

Parameter Direction Type Max length Description
:templateId Input long N/A a.DocumentTemplateSeqNum == inId (L135) / == templateId (L957) → column DOCUMENT_TEMPLATE_SEQ_NUM

Tables

Table Access Columns used
DOCUMENT_TEMPLATE_OPTION SELECT all mapped columns; filter DOCUMENT_TEMPLATE_SEQ_NUM

LINQ statement

Source: Services/SAIF.Services/Documents/TemplateSearchService.cs:130. Additional fragments at :135, :957.

// Services/SAIF.Services/Documents/TemplateSearchService.cs:130
var codeRecords = unitOfWork.GetRepository<DocumentTemplateOption>().Query().ToList();

// Services/SAIF.Services/Documents/TemplateSearchService.cs:135
var codeRecords = unitOfWork.GetRepository<DocumentTemplateOption>().Query().Where(a => a.DocumentTemplateSeqNum == inId).ToList();

// Services/SAIF.Services/Documents/TemplateSearchService.cs:957
var optionRecords = unitOfWork.GetRepository<DocumentTemplateOption>().Query().Where(a => a.DocumentTemplateSeqNum == templateId).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
-- (1) L130 — GetAllTemplateOptions
SELECT DTO.DOCUMENT_OPTION_SEQ_NUM,
       DTO.DOCUMENT_TEMPLATE_SEQ_NUM,
       DTO.CREATE_USER,
       DTO.CREATE_DATE,
       DTO.DOCUMENT_OPTION_CODE
FROM   DOCUMENT_TEMPLATE_OPTION DTO;

-- (2) L135 — GetOptionsForOneTemplate / (3) L957 — GetDocumentSqlLines
SELECT <same column list>
FROM   DOCUMENT_TEMPLATE_OPTION DTO
WHERE  DTO.DOCUMENT_TEMPLATE_SEQ_NUM = :templateId;   -- :inId (L135) / :templateId (L957)

Translation notes: - Mapping quirk: leading space in .Column(" DOCUMENT_TEMPLATE_SEQ_NUM") (trimmed here). - All three statements are materialized by .ToList().

Operations and processes

Business rules

Sources

  • Services/SAIF.Services/Documents/TemplateSearchService.cs (L130, L135, L957)