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

# SQL-366: Delete Certificate via DeleteCertificate

This statement deletes the `Certificate` entity identified by its identifier (`CERTIFICATE_SEQ_NUM`) via `IUnitOfWork.GetRepository<T>().Delete(entity)`, invoked from `CertificateService.DeleteCertificate` (`Services/SAIF.Services/Policies/Certificates/CertificateService.cs:343`). The SQL below is inferred from this repository call and the `Certificate` NHibernate mapping — it is not literal SQL present in source.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-366 |
| **Operation type** | Delete |
| **Execution method** | ORM (IRepository.Delete) |
| **Database** | Oracle |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `Certificate` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `DeleteCertificate` |

## Parameters

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [CERTIFICATE_DETAIL](../database-tables.md#certificate_detail) | DELETE | `CERTIFICATE_SEQ_NUM` |

## LINQ statement

Source: `Services/SAIF.Services/Policies/Certificates/CertificateService.cs:343`

```csharp
// Services/SAIF.Services/Policies/Certificates/CertificateService.cs:343
unitOfWork.GetRepository<CertData.Certificate>().Delete(certificate);
```

## 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 CERTIFICATE_DETAIL
WHERE CERTIFICATE_SEQ_NUM = :Id
```

Translation notes:

- Entity loaded by `GetCertificateDataById(certificateId)` (line 339) - separate read. No cascades are declared on `CertificateMap`.

## Operations and processes
- CertificateService.DeleteCertificate — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Policies/Certificates/CertificateService.cs (L343)`
