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

# SQL-063: Create XDocument via GenerateCashDisbursements

This ORM statement performs a create operation on `XDocument` via `GenerateCashDisbursements`, executed from `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs` (L318).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:XPrintControl` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:XBinType` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` (column pairing unresolved) |
| `:DocumentType` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` (column pairing unresolved) |
| `:DuplexMode` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` (column pairing unresolved) |
| `:FileName` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:EmailAddress` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:FaxNumber` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` (column pairing unresolved) |
| `:IdxContentsText` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:PrintGroupText` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:StartValue` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:CopiesCount` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort0Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort1Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort2Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort3Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort4Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort5Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort6Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort7Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort8Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |
| `:Sort9Value` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XDocument` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [XDOCUMENT](../database-tables.md#xdocument)** | INSERT | XDOCUMENT_SEQ_NUM, XPRINT_CONTROL_SEQ_NUM, XBIN_TYPE_CODE, DOCUMENT_TYPE_CODE, DUPLEX_CODE, FILE_NAME, EMAIL_ADDRESS, FAX_NUM, IDX_CONTENTS_TEXT, PRINT_GROUP_TEXT, START_VALUE, COPIES_COUNT, SORT0_VALUE, SORT1_VALUE, SORT2_VALUE, SORT3_VALUE, SORT4_VALUE, SORT5_VALUE, SORT6_VALUE, SORT7_VALUE, SORT8_VALUE, SORT9_VALUE |

## LINQ statement

Source: `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:318`.

```csharp
// Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:318
_unitOfWork.GetRepository<PrintData.XDocument>().Add(xDocument);
```

## 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 XDOCUMENT_SEQ.NEXTVAL
FROM DUAL

INSERT INTO XDOCUMENT (
  XDOCUMENT_SEQ_NUM,
  XPRINT_CONTROL_SEQ_NUM,
  XBIN_TYPE_CODE, -- unresolved mapping: XDocument.XBinType (column pairing inferred)
  DOCUMENT_TYPE_CODE, -- unresolved mapping: XDocument.DocumentType (column pairing inferred)
  DUPLEX_CODE, -- unresolved mapping: XDocument.DuplexMode (column pairing inferred)
  FILE_NAME,
  EMAIL_ADDRESS,
  FAX_NUM, -- unresolved mapping: XDocument.FaxNumber (column pairing inferred)
  IDX_CONTENTS_TEXT,
  PRINT_GROUP_TEXT,
  START_VALUE,
  COPIES_COUNT,
  SORT0_VALUE,
  SORT1_VALUE,
  SORT2_VALUE,
  SORT3_VALUE,
  SORT4_VALUE,
  SORT5_VALUE,
  SORT6_VALUE,
  SORT7_VALUE,
  SORT8_VALUE,
  SORT9_VALUE)
VALUES (
  :Id,
  :XPrintControl,
  :XBinType,
  :DocumentType,
  :DuplexMode,
  :FileName,
  :EmailAddress,
  :FaxNumber,
  :IdxContentsText,
  :PrintGroupText,
  :StartValue,
  :CopiesCount,
  :Sort0Value,
  :Sort1Value,
  :Sort2Value,
  :Sort3Value,
  :Sort4Value,
  :Sort5Value,
  :Sort6Value,
  :Sort7Value,
  :Sort8Value,
  :Sort9Value)
```

Translation notes:
- `XDocument` (`SAIF.Data.Model.Printing`) is mapped outside this repository; no `ClassMap<XDocument>` exists under `Data/SAIF.Data.NHibernate/Mappings/**`. Legends confirms `XDocumentMap` in SAIF.Framework.Data.NHibernate (`Mappings/Printing/`) with table `XDOCUMENT` and native sequence `XDOCUMENT_SEQ`, but the ClassMap source is not indexed.
- The column list is taken from the documented ADO.NET INSERT in SAIF.Services.Printing.Remote (`Claims.BOF.Components/docs/libraries/saif-services-printing-remote/sql/SQL-006-saif-services-printing-remote.md`, via Legends) and the XDOCUMENT table docs; it is **not ClassMap-verified**. Property-to-column pairings whose names differ (`XBinType`, `DocumentType`, `DuplexMode`, `FaxNumber`) are marked `-- unresolved mapping`.
- `:XPrintControl` is the identifier of the associated `XPrintControl` (many-to-one); `XPRINT_CONTROL` is not read or joined by this statement.
- `:Id` is the value fetched from `XDOCUMENT_SEQ` before the INSERT.
- `xDocument` properties (`FileName`, `Sort0Value`, `StartValue`) are reassigned after `Add` at `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:319,320,321`, using the newly assigned `Id`; a stateful session flushes these as a subsequent `UPDATE XDOCUMENT` at commit — a separate statement, not shown.

## Operations and processes
- WitnessSubpoenaProcess.GenerateCashDisbursements — see [Operations and processes](../operations-processes.md)

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

## Sources
- `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs (L318)`
