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

# SQL-028: Create EbillInvoice via ProcessInvoiceFile

This ORM statement performs a create operation on `EbillInvoice` via `ProcessInvoiceFile`, executed from `Services/SAIF.Services/Claims/EBilling/EBillingService.cs` (L1271).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `long` | N/A | Identifier from `EBILL_INVOICE_SEQ.NEXTVAL` |
| `:UpdateNumber` | Input | `int` | N/A | Version column (`Version()`); NHibernate writes its initial value |
| `:ReceivedDate` | Input | `DateTime` | N/A |  |
| `:BeginDate` | Input | `DateTime` | N/A |  |
| `:EndDate` | Input | `DateTime` | N/A |  |
| `:TransactionFeeAmount` | Input | `decimal` | N/A |  |
| `:InvoiceAmount` | Input | `decimal` | N/A |  |
| `:UpdateDate` | Input | `DateTime` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |
| `:Clearinghouse` | Input | `EbillClearinghouse` | N/A | Identifier of the referenced `EbillClearinghouse` entity (`References(x => x.Clearinghouse)`) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [EBILL_INVOICE](../database-tables.md#ebill_invoice) | INSERT | EBILL_INVOICE_SEQ_NUM, UPDATE_NUM, RECEIVED_DATE, BEGIN_DATE, END_DATE, TRANSACTION_FEE_AMT, INVOICE_AMOUNT, UPDATE_DATE, UPDATE_USER, EBILL_CLEARINGHOUSE_SEQ_NUM (identifier from sequence `EBILL_INVOICE_SEQ.NEXTVAL`) |

## LINQ statement

Source: `Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1271`.

```csharp
// Services/SAIF.Services/Claims/EBilling/EBillingService.cs:1271
_unitOfWork.GetRepository<EbillInvoice>().Add(thisInvoice);
```

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

INSERT INTO EBILL_INVOICE (
  EBILL_INVOICE_SEQ_NUM,
  UPDATE_NUM,
  RECEIVED_DATE,
  BEGIN_DATE,
  END_DATE,
  TRANSACTION_FEE_AMT,
  INVOICE_AMOUNT,
  UPDATE_DATE,
  UPDATE_USER,
  EBILL_CLEARINGHOUSE_SEQ_NUM)
VALUES (
  :Id,
  :UpdateNumber,
  :ReceivedDate,
  :BeginDate,
  :EndDate,
  :TransactionFeeAmount,
  :InvoiceAmount,
  :UpdateDate,
  :UpdateUser,
  :Clearinghouse)
```

Translation notes:
- `:Id` is the value fetched from sequence `EBILL_INVOICE_SEQ` (`GeneratedBy.Native("EBILL_INVOICE_SEQ")`) before the INSERT; NHibernate assigns it to `EbillInvoice.Id`.
- `UPDATE_NUM` is the optimistic-concurrency version column (`Version(x => x.UpdateNumber)`); NHibernate sets its initial value on INSERT.
- Reference FK values are bound from the associated entity's identifier; the referenced tables are **not** read or joined by this statement: `Clearinghouse` → `EBILL_CLEARINGHOUSE_SEQ_NUM` (entity table `EBILL_CLEARINGHOUSE` not accessed).
- Cascade: `HasMany(x => x.Bills)` is mapped with `Cascade.AllDeleteOrphan()`; any transient instances in that association are saved in their own statements (not fabricated here).
- Cascade: `HasMany(x => x.Errors)` is mapped with `Cascade.AllDeleteOrphan()`; any transient instances in that association are saved in their own statements (not fabricated here).

## Operations and processes
- EbillingService.ProcessInvoiceFile — see [Operations and processes](../operations-processes.md)

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

## Sources
- `Services/SAIF.Services/Claims/EBilling/EBillingService.cs (L1271)`
