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

# SQL-005: AuditNoteQueryProvider.GetAuditNotesForClaim

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

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-005 |
| **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** | `GetAuditNotesForClaim` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `claimId` | Input | long | N/A | Method argument of `AuditNoteQueryProvider.GetAuditNotesForClaim` bound into the ORM expression; NHibernate generates the bind variable at runtime |
| `includeInactive` | Input | bool | N/A | Method argument of `AuditNoteQueryProvider.GetAuditNotesForClaim` 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, ACTIVE_FLAG, CREATE_DATE, CREATE_USER, UPDATE_DATE, UPDATE_USER, NOTE_TXT, CLAIM_ID, NOTE_TYPE_CODE, NOTE_CATEGORY_CODE, BILL_ID |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Claims/AuditNoteQueryProvider.cs:25`. The repository is a class field initialised from `Factory.GetRepository<CbpNote>().Query()` at `Data/SAIF.Data/Queries/Claims/AuditNoteQueryProvider.cs:14`.

```csharp
return repository.Where(x => x.ClaimId == claimId
    && (x.IsActive || x.IsActive != includeInactive)).ToList();
```

## 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
  CN.CBP_NOTE_SEQ_NUM,
  CN.UPDATE_NUM,
  CN.ACTIVE_FLAG,
  CN.CREATE_DATE,
  CN.CREATE_USER,
  CN.UPDATE_DATE,
  CN.UPDATE_USER,
  CN.NOTE_TXT,
  CN.CLAIM_ID,
  CN.NOTE_TYPE_CODE,
  CN.NOTE_CATEGORY_CODE,
  CN.BILL_ID
FROM CBP_NOTE CN
WHERE CN.CLAIM_ID = :claimId
  AND (CN.ACTIVE_FLAG = 'Y' OR CN.ACTIVE_FLAG <> :includeInactive)
```

Translation notes:
- The predicate returns active notes, plus inactive notes when `includeInactive = true`. With `includeInactive = true`, inactive notes pass because `'N' <> 'Y'`.
- `ClaimId` is a plain `Map` column, so no navigation is involved.

## Operations and processes

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


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