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

# SQL-039: Create Note via CreateNote

This ORM statement performs a create operation on `Note` via `CreateNote`, executed from `Services/SAIF.Services/Collections/CollectionsService.cs` (L833).

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | `long` | N/A | Identifier from `LEGAL_COLLECTION_NOTE_SEQ.NEXTVAL` |
| `:CaseId` | Input | `long` | N/A |  |
| `:NoteText` | Input | `string` | N/A |  |
| `:CreateDate` | Input | `DateTime` | N/A |  |
| `:CreateUser` | Input | `string` | N/A |  |
| `:UpdateDate` | Input | `DateTime?` | N/A |  |
| `:UpdateUser` | Input | `string` | N/A |  |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [LEGAL_COLLECTION_NOTE](../database-tables.md#legal_collection_note) | INSERT | LEGAL_COLLECTION_NOTE_SEQ_NUM, LEGAL_COLLECTION_SEQ_NUM, TEXT, CREATE_DATE, CREATE_USER, UPDATE_DATE, UPDATE_USER (identifier from sequence `LEGAL_COLLECTION_NOTE_SEQ.NEXTVAL`) |

## LINQ statement

Source: `Services/SAIF.Services/Collections/CollectionsService.cs:833`.

```csharp
// Services/SAIF.Services/Collections/CollectionsService.cs:833
UnitOfWork.GetRepository<DataModel.Note>().Add(dataNote);
```

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

INSERT INTO LEGAL_COLLECTION_NOTE (
  LEGAL_COLLECTION_NOTE_SEQ_NUM,
  LEGAL_COLLECTION_SEQ_NUM,
  TEXT,
  CREATE_DATE,
  CREATE_USER,
  UPDATE_DATE,
  UPDATE_USER)
VALUES (
  :Id,
  :CaseId,
  :NoteText,
  :CreateDate,
  :CreateUser,
  :UpdateDate,
  :UpdateUser)
```

Translation notes:
- `:Id` is the value fetched from sequence `LEGAL_COLLECTION_NOTE_SEQ` (`GeneratedBy.Native("LEGAL_COLLECTION_NOTE_SEQ")`) before the INSERT; NHibernate assigns it to `Note.Id`.

## Operations and processes
- CollectionsService.CreateNote — 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/CollectionsService.cs (L833)`
