---
title: "SQL-012: AuditNoteQueryProvider.IsAuditNoteNoContention"
summary: Read operation for `AuditNoteQueryProvider.IsAuditNoteNoContention`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-012: AuditNoteQueryProvider.IsAuditNoteNoContention

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `AuditNoteQueryProvider.IsAuditNoteNoContention`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-012 |
| **Operation type** | Read |
| **Execution method** | ORM (NHibernate LINQ) |
| **Database** | Oracle* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `AuditNoteQueryProvider` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `IsAuditNoteNoContention` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `noteId` | Input | long | N/A | Method argument of `AuditNoteQueryProvider.IsAuditNoteNoContention` bound into the ORM expression; NHibernate generates the bind variable at runtime |
| `updateNumber` | Input | int | N/A | Method argument of `AuditNoteQueryProvider.IsAuditNoteNoContention` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CBP_NOTE](../database-tables.md#cbp_note) | SELECT | CBP_NOTE_SEQ_NUM, UPDATE_NUM |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/AuditNoteQueryProvider.cs:74`. The repository is a class field initialised from `Factory.GetRepository<CbpNote>().Query()` at `Data/SAIF.Data/Queries/Claims/AuditNoteQueryProvider.cs:14`. The query is guarded by `if (noteId == 0) return true;` at `:68-71`.

```csharp
return repository.Any(x => x.Id == noteId && x.UpdateNumber == updateNumber);
```

## 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 1
FROM CBP_NOTE CN
WHERE CN.CBP_NOTE_SEQ_NUM = :noteId
  AND CN.UPDATE_NUM = :updateNumber
  AND ROWNUM <= 1
```

Translation notes:
- `Any()` is an existence check. NHibernate may emit `CASE WHEN EXISTS (…)` instead; the semantics are the same.
- No query runs when `noteId == 0`.

## Operations and processes

- [Audit note concurrency check](../operations/audit-note-concurrency-check.md)

## Business rules

- [SD-BR-033 Audit note save allowed only under optimistic concurrency match](../business-rules.md#sd-br-033-audit-note-save-allowed-only-under-optimistic-concurrency-match)

## Sources
- `Data/SAIF.Data/Queries/Claims/AuditNoteQueryProvider.cs:74`
