SQL-020: Create DocumentDistributionLog¶
This ORM statement performs a create operation on DocumentDistributionLog via CreateDocumentDistributionRecord, GetNextDistributionRecordKey, executed from Services/SAIF.Services/Documents/DocumentRequestService.cs (L487), Services/SAIF.Services/Documents/DocumentRequestService.cs (L522).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-020 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | DocumentDistributionLog |
| Criteria property | N/A — ORM |
| Lifecycle method | CreateDocumentDistributionRecord, GetNextDistributionRecordKey |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long |
N/A | Identifier from DOCUMENT_DISTRIBUTION_LOG_SEQ.NEXTVAL |
:DocumentRequestLogSeqNum |
Input | long |
N/A | |
:DocRequestLogStatusCode |
Input | string |
N/A | |
:PlannedDistributionDate |
Input | DateTime? |
N/A | |
:ActualDistributionDate |
Input | DateTime? |
N/A | |
:PackageName |
Input | string |
N/A | |
:Xml |
Input | string |
N/A | |
:PrinterName |
Input | string |
N/A | |
:PrintMode |
Input | string |
N/A | |
:Copies |
Input | long |
N/A | |
:ScaleMode |
Input | string |
N/A | |
:OutputProfile |
Input | string |
N/A | |
:ImportInfo |
Input | string |
N/A | |
:EmailInfo |
Input | string |
N/A | |
:FaxInfo |
Input | string |
N/A | |
:ImagePath |
Input | string |
N/A | |
:Tray |
Input | string |
N/A | |
:DeferredInfo |
Input | string |
N/A | |
:CertificationInfo |
Input | string |
N/A | |
:Application |
Input | string |
N/A | |
:CreateUser |
Input | string |
N/A | |
:CreateDate |
Input | DateTime |
N/A | |
:UpdateUser |
Input | string |
N/A | |
:UpdateDate |
Input | DateTime |
N/A |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| DOCUMENT_DISTRIBUTION_LOG | INSERT | DOCUMENT_DIST_LOG_SEQ_NUM, DOCUMENT_REQUEST_LOG_SEQ_NUM, DOC_REQUEST_LOG_STATUS_CODE, PLANNED_DISTRIBUTION_DATE, ACTUAL_DISTRIBUTION_DATE, PACKAGE_NAME, XML, PRINTER_NAME, PRINT_MODE, COPIES, SCALE_MODE, OUTPUT_PROFILE, IMPORT_INFO, EMAIL_INFO, FAX_INFO, IMAGE_PATH, TRAY, DEFERRED_INFO, CERTIFICATION_INFO, APPLICATION, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE (identifier from sequence DOCUMENT_DISTRIBUTION_LOG_SEQ.NEXTVAL) |
LINQ statement¶
Source: Services/SAIF.Services/Documents/DocumentRequestService.cs:487, Services/SAIF.Services/Documents/DocumentRequestService.cs:522.
// Services/SAIF.Services/Documents/DocumentRequestService.cs:487
UnitOfWork.GetRepository<DocumentDistributionLog>().Add(newLog);
// Services/SAIF.Services/Documents/DocumentRequestService.cs:522
UnitOfWork.GetRepository<DocumentDistributionLog>().Add(newLog);
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 DOCUMENT_DISTRIBUTION_LOG_SEQ.NEXTVAL
FROM DUAL
INSERT INTO DOCUMENT_DISTRIBUTION_LOG (
DOCUMENT_DIST_LOG_SEQ_NUM,
DOCUMENT_REQUEST_LOG_SEQ_NUM,
DOC_REQUEST_LOG_STATUS_CODE,
PLANNED_DISTRIBUTION_DATE,
ACTUAL_DISTRIBUTION_DATE,
PACKAGE_NAME,
XML,
PRINTER_NAME,
PRINT_MODE,
COPIES,
SCALE_MODE,
OUTPUT_PROFILE,
IMPORT_INFO,
EMAIL_INFO,
FAX_INFO,
IMAGE_PATH,
TRAY,
DEFERRED_INFO,
CERTIFICATION_INFO,
APPLICATION,
CREATE_USER,
CREATE_DATE,
UPDATE_USER,
UPDATE_DATE)
VALUES (
:Id,
:DocumentRequestLogSeqNum,
:DocRequestLogStatusCode,
:PlannedDistributionDate,
:ActualDistributionDate,
:PackageName,
:Xml,
:PrinterName,
:PrintMode,
:Copies,
:ScaleMode,
:OutputProfile,
:ImportInfo,
:EmailInfo,
:FaxInfo,
:ImagePath,
:Tray,
:DeferredInfo,
:CertificationInfo,
:Application,
:CreateUser,
:CreateDate,
:UpdateUser,
:UpdateDate)
Translation notes:
- :Id is the value fetched from sequence DOCUMENT_DISTRIBUTION_LOG_SEQ (GeneratedBy.Native("DOCUMENT_DISTRIBUTION_LOG_SEQ")) before the INSERT; NHibernate assigns it to DocumentDistributionLog.Id.
- Two call sites. GetNextDistributionRecordKey (:487) calls Add, reads newLog.Id, then UnitOfWork.Rollback() (line 489). With a native sequence generator NHibernate fetches DOCUMENT_DISTRIBUTION_LOG_SEQ.NEXTVAL at Add time but defers the INSERT to flush; the rollback discards the unflushed entity, so at this call site only the SELECT ... NEXTVAL is expected to reach the database (a key-reservation technique). CreateDocumentDistributionRecord (:522) commits, so the full INSERT executes.
Operations and processes¶
- DocumentRequestService.CreateDocumentDistributionRecord — see Operations and processes
- DocumentRequestService.GetNextDistributionRecordKey — see Operations and processes
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Documents/DocumentRequestService.cs (L487, L522)