---
title: "SQL-023: Create DocumentRequestLog via SubmitDocumentRequest"
summary: Create operation against DocumentRequestLog via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-023: Create DocumentRequestLog via SubmitDocumentRequest

This ORM statement performs a create operation on `DocumentRequestLog` via `SubmitDocumentRequest`, executed from `Services/SAIF.Services/Documents/DocumentRequestService.cs` (L609).

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-023 |
| **Operation type** | Create |
| **Execution method** | ORM (IRepository.Add) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `DocumentRequestLog` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `SubmitDocumentRequest` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `long` | N/A | Identifier from `DOCUMENT_REQUEST_LOG_SEQ.NEXTVAL` |
| `:DocRequestLogStatusCode` | Input | `string` | N/A |  |
| `:UserId` | Input | `string` | N/A |  |
| `:CreateUser` | Input | `string` | N/A |  |
| `:CreateDate` | Input | `DateTime` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |
| `:UpdateDate` | Input | `DateTime` | N/A |  |
| `:UpdateNumber` | Input | `int` | N/A |  |
| `:ContextValue` | Input | `string` | N/A |  |
| `:MyDocTemplate` | Input | `DocumentTemplate` | N/A | Identifier of the referenced `DocumentTemplate` entity (`References(x => x.MyDocTemplate)`) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [DOCUMENT_REQUEST_LOG](../database-tables.md#document_request_log) | INSERT | DOCUMENT_REQUEST_LOG_SEQ_NUM, DOC_REQUEST_LOG_STATUS_CODE, SAIF_MAIL_ID, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, UPDATE_NUM, CONTEXT_VALUE, DOCUMENT_TEMPLATE_SEQ_NUM (identifier from sequence `DOCUMENT_REQUEST_LOG_SEQ.NEXTVAL`) |

## LINQ statement

Source: `Services/SAIF.Services/Documents/DocumentRequestService.cs:609`.

```csharp
// Services/SAIF.Services/Documents/DocumentRequestService.cs:609
UnitOfWork.GetRepository<DocumentRequestLog>().Add(request);
```

## 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.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT DOCUMENT_REQUEST_LOG_SEQ.NEXTVAL
FROM DUAL

INSERT INTO DOCUMENT_REQUEST_LOG (
  DOCUMENT_REQUEST_LOG_SEQ_NUM,
  DOC_REQUEST_LOG_STATUS_CODE,
  SAIF_MAIL_ID,
  CREATE_USER,
  CREATE_DATE,
  UPDATE_USER,
  UPDATE_DATE,
  UPDATE_NUM,
  CONTEXT_VALUE,
  DOCUMENT_TEMPLATE_SEQ_NUM)
VALUES (
  :Id,
  :DocRequestLogStatusCode,
  :UserId,
  :CreateUser,
  :CreateDate,
  :UpdateUser,
  :UpdateDate,
  :UpdateNumber,
  :ContextValue,
  :MyDocTemplate)
```

Translation notes:
- `:Id` is the value fetched from sequence `DOCUMENT_REQUEST_LOG_SEQ` (`GeneratedBy.Native("DOCUMENT_REQUEST_LOG_SEQ")`) before the INSERT; NHibernate assigns it to `DocumentRequestLog.Id`.
- Reference FK values are bound from the associated entity's identifier; the referenced tables are **not** read or joined by this statement: `MyDocTemplate` → `DOCUMENT_TEMPLATE_SEQ_NUM` (entity table `DOCUMENT_TEMPLATE` not accessed).

## Operations and processes
- DocumentRequestService.SubmitDocumentRequest — see [Operations and processes](../operations-processes.md)

## Business rules
- [SVC-BR-DOC-001 Template must exist - 'Error - Template does not exist.'](../business-rules.md#svc-br-doc-001-template-must-exist---'error---template-does-not-exist.')

> **Note:** Statements marked with `**` could not be confirmed; treat as unknown until verified.

## Sources
- `Services/SAIF.Services/Documents/DocumentRequestService.cs (L609)`
