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

# SQL-019: Create DeptRevenueSoilBalance via InsertBalanceRecords

This ORM statement performs a create operation on `DeptRevenueSoilBalance` via `InsertBalanceRecords`, executed from `Services/SAIF.Services/Collections/SoilService.cs` (L255), `Services/SAIF.Services/Collections/SoilService.cs` (L262).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:RecievedBySaifDate` | Input | `DateTime` | N/A | Composite-key part |
| `:Ssn` | Input | `string` | N/A | Composite-key part |
| `:UpdateNum` | Input | `int` | N/A | Version column (`Version()`); NHibernate writes its initial value |
| `:ReferenceText` | Input | `string` | N/A |  |
| `:BalanceAmount` | Input | `decimal` | N/A |  |
| `:DebtorName` | Input | `string` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |
| `:UpdateDate` | Input | `DateTime` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [DEPT_REVENUE_SOIL_BALANCE](../database-tables.md#dept_revenue_soil_balance) | INSERT | RECEIVED_BY_SAIF_DATE, SSN, UPDATE_NUM, REFERENCE_TEXT, BALANCE_AMT, DEBTOR_NAME, UPDATE_USER, UPDATE_DATE |

## LINQ statement

Source: `Services/SAIF.Services/Collections/SoilService.cs:255`, `Services/SAIF.Services/Collections/SoilService.cs:262`.

```csharp
// Services/SAIF.Services/Collections/SoilService.cs:255
UnitOfWork.GetRepository<DataModel.DeptRevenueSoilBalance>().Add(lastBalance);

// Services/SAIF.Services/Collections/SoilService.cs:262
UnitOfWork.GetRepository<DataModel.DeptRevenueSoilBalance>().Add(lastBalance);
```

## 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 DEPT_REVENUE_SOIL_BALANCE (
  RECEIVED_BY_SAIF_DATE,
  SSN,
  UPDATE_NUM,
  REFERENCE_TEXT,
  BALANCE_AMT,
  DEBTOR_NAME,
  UPDATE_USER,
  UPDATE_DATE)
VALUES (
  :RecievedBySaifDate,
  :Ssn,
  :UpdateNum,
  :ReferenceText,
  :BalanceAmount,
  :DebtorName,
  :UpdateUser,
  :UpdateDate)
```

Translation notes:
- Composite identifier (`CompositeId()`) with no generator: every key part is supplied by the caller. A stateful `SaveOrUpdate` on a composite-key entity may first issue a `SELECT` by the key columns to decide between INSERT and UPDATE unless the version unsaved-value identifies the instance as transient.
- `UPDATE_NUM` is the optimistic-concurrency version column (`Version(x => x.UpdateNum)`); NHibernate sets its initial value on INSERT.
- Two call sites (`:255` and `:262`) produce the same INSERT shape.

## Operations and processes
- SoilService.InsertBalanceRecords — see [Operations and processes](../operations-processes.md)

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

## Sources
- `Services/SAIF.Services/Collections/SoilService.cs (L255, L262)`
