---
title: "SQL-383: Delete LegalNote via DeleteNote"
summary: Delete operation against LegalNote via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-383: Delete LegalNote via DeleteNote

This statement deletes the `LegalNote` entity identified by its `CASE_NOTE_SEQ_NUM` key from `LEGAL.CASE_NOTE`, executed via `IUnitOfWork.GetRepository<T>().Delete(...)` from `Services/SAIF.Services/Legal/Notes/LegalNotesService.cs (L191)` in `LegalNotesService.DeleteNote`. The SQL below is inferred from this repository call and the NHibernate `LegalNoteMap` mapping — it is not literal SQL present in source.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-383 |
| **Operation type** | Delete |
| **Execution method** | ORM (IRepository.Delete) |
| **Database** | Oracle |
| **Schema** | LEGAL |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `LegalNote` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `DeleteNote` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:Id` | Input | long | N/A | Identifier of the LegalNote being deleted (`CASE_NOTE_SEQ_NUM`) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CASE_NOTE](../database-tables.md#case_note) | DELETE | `CASE_NOTE_SEQ_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Legal/Notes/LegalNotesService.cs:191`

```csharp
// Services/SAIF.Services/Legal/Notes/LegalNotesService.cs:191
UnitOfWork.GetRepository<LegalData.LegalNote>().Delete(note);
```

## 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
DELETE FROM LEGAL.CASE_NOTE
WHERE CASE_NOTE_SEQ_NUM = :Id
```

Translation notes:

- `Schema("LEGAL")` (line 13) qualifies the table.
- Entity loaded at line 190 (separate read).

## Operations and processes
- LegalNotesService.DeleteNote — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Legal/Notes/LegalNotesService.cs (L191)`
