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

# SQL-068: Create XPrintControl

This ORM statement performs a create operation on `XPrintControl` via `GenerateWitnessCashDisbursementRequest, GenerateWitnessDocuments`, executed from `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs` (L78), `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs` (L128).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |
| `:DirectoryName` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |
| `:DuplexMode` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` (column pairing unresolved) |
| `:ProcessedDate` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |
| `:IdmPathName` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |
| `:XmlFileName` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |
| `:Md5HashValue` | Input | `external (SAIF.Framework.Core)` | N/A | Property of `XPrintControl` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [XPRINT_CONTROL](../database-tables.md#xprint_control)** | INSERT | XPRINT_CONTROL_SEQ_NUM, DIRECTORY_NAME, DUPLEX_CODE, PROCESSED_DATE, IDM_PATH_NAME, XML_FILE_NAME, MD5_HASH_VALUE |

## LINQ statement

Source: `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:78`, `Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:128`.

```csharp
// Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:78
_unitOfWork.GetRepository<PrintData.XPrintControl>().Add(xPrintControl);

// Services/SAIF.Services/Legal/Subpoenas/WitnessSubpoenaProcess.cs:128
_unitOfWork.GetRepository<PrintData.XPrintControl>().Add(xPrintControl);
```

## 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
INSERT INTO XPRINT_CONTROL (
  XPRINT_CONTROL_SEQ_NUM,
  DIRECTORY_NAME,
  DUPLEX_CODE, -- unresolved mapping: XPrintControl.DuplexMode (column pairing inferred)
  PROCESSED_DATE,
  IDM_PATH_NAME,
  XML_FILE_NAME,
  MD5_HASH_VALUE)
VALUES (
  :Id,
  :DirectoryName,
  :DuplexMode,
  :ProcessedDate,
  :IdmPathName,
  :XmlFileName,
  :Md5HashValue)
```

Translation notes:
- `XPrintControl` (`SAIF.Data.Model.Printing`) is mapped outside this repository; no `ClassMap<XPrintControl>` exists in-repo. Legends confirms `XPrintControlMap` in SAIF.Framework.Data.NHibernate with table `XPRINT_CONTROL`, identifier column `XPRINT_CONTROL_SEQ_NUM` and `GeneratedBy.Assigned()`; the ClassMap source is not indexed.
- `GeneratedBy.Assigned()`: `:Id` is supplied by the caller (for example `Id = batchArguments.PrintControlSequenceNumber` at `BillPaymentService.cs:600`). A stateful `SaveOrUpdate` with an assigned identifier may first issue a `SELECT` by `XPRINT_CONTROL_SEQ_NUM` to decide between INSERT and UPDATE.
- The column list is taken from the documented ADO.NET INSERT in SAIF.Services.Printing.Remote (`SQL-007-saif-services-printing-remote.md`, via Legends); **not ClassMap-verified**. `DuplexMode` → `DUPLEX_CODE` is marked `-- unresolved mapping`.
- The XPRINT_CONTROL table docs also list `CREATE_DATE`, and call sites set `CreateDate`, but the documented INSERT omits it and the ClassMap is unavailable, so whether NHibernate writes `CREATE_DATE` is unresolved (`-- unresolved mapping: XPrintControl.CreateDate`); it is not added to the INSERT.
- Legends reports `HasMany(XDocuments)` as inverse; any cascade setting is not documented. `XDOCUMENT` rows are written by separate `Add` calls (SQL-060..064).

## Operations and processes
- WitnessSubpoenaProcess.GenerateWitnessCashDisbursementRequest — see [Operations and processes](../operations-processes.md)
- WitnessSubpoenaProcess.GenerateWitnessDocuments — 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 (L78, L128)`
