---
title: "SQL-001: Oracle sequence-based ID generation for Image"
summary: Fetches the next value of the image_seq Oracle sequence for a new Image entity.
status: draft
owner: Framework
last_reviewed: 2026-09-15
library: SAIF.Framework.Data.NHibernate
reference_type: package
---

# SQL-001: Oracle sequence-based ID generation for Image

This statement is a direct SQL escape hatch used by `ImageRepositoryExtensions.GetNextImageId` to obtain the next `long` value of the `image_seq` Oracle sequence, bypassing the mapped-entity ID-generation path (the `Image` entity's `image_seq_num` identity column has no `GeneratedBy` clause, so this call is its only path to an ID).

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-001 |
| **Operation type** | Sequence |
| **Execution method** | Inline SQL (`ISessionStrategy.CreateSqlQuery`) |
| **Database** | Oracle |
| **Schema** | `[unqualified]**` |
| **Command type** | Text |
| **Business object** | `Image` (via `IRepository<Image>` extension) |
| **Criteria property** | N/A — no `IBusinessCriteria` exists in this library |
| **Lifecycle method** | `ImageRepositoryExtensions.GetNextImageId` |

## Parameters

No parameters — this is a literal, parameterless sequence-name query with no bind variables.

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [image](../database-tables.md#image) | SELECT (sequence value only; no table row read) | — (`image_seq.nextval`, no column reference) |

## Sample SQL

```sql
select image_seq.nextval
from dual
```

## Operations and processes
- [Oracle sequence based ID generation (Imaging domain)](../operations-processes.md#oracle-sequence-based-id-generation-imaging-domain)

## Business rules
No business rule governs this statement directly — the sequence read is unconditional. The generated value's use is governed by [BR-005](../business-rules.md#br-005-repository-is-scoped-to-one-unit-of-work) once the caller assigns it to a new `Image` and calls `Add()`.

## Sources
- `Repositories/Imaging/ImageRepositoryExtensions.cs`
