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

# SQL-002: Create BatchProcessLog via UpdateRunDate

This ORM statement performs a create operation on `BatchProcessLog` via `UpdateRunDate`, executed from `Services/SAIF.Services/BatchProcessing/BatchProcessingService.cs` (L38).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Module` | Input | `string` | N/A | Identifier supplied by the caller |
| `:ControlText` | Input | `string` | N/A |  |
| `:RunDate` | Input | `DateTime` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [batch_process_log](../database-tables.md#batch_process_log) | INSERT | module, control_text, run_date |

## LINQ statement

Source: `Services/SAIF.Services/BatchProcessing/BatchProcessingService.cs:38`.

```csharp
// Services/SAIF.Services/BatchProcessing/BatchProcessingService.cs:18
_repository = _unitOfWork.GetRepository<BatchProcessLog>();

// Services/SAIF.Services/BatchProcessing/BatchProcessingService.cs:38
_repository.Add(record);
```

## 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 batch_process_log (
  module,
  control_text,
  run_date)
VALUES (
  :Module,
  :ControlText,
  :RunDate)
```

Translation notes:
- No generator is declared on `Id(Module)` (type `string`); FluentNHibernate defaults a non-integral identifier to `assigned`, so `:Module` is supplied by the caller. A stateful `SaveOrUpdate` may first issue a `SELECT` by `module` to decide between INSERT and UPDATE.
- The same method (`UpdateRunDate`) calls `_repository.Update(record)` at `BatchProcessingService.cs:43` when the row already exists; that UPDATE is a separate statement and is not part of this Create SQL ID. The existence check `GetSingleRecord(moduleName)` at line 33 is also a separate SELECT.

## Operations and processes
- BatchProcessingService.UpdateRunDate — see [Operations and processes](../operations-processes.md)

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

## Sources
- `Services/SAIF.Services/BatchProcessing/BatchProcessingService.cs (L38)`
