SQL-392: Delete Subpoena via DeleteSubpoena¶
This statement deletes the Subpoena entity identified by its SUBPOENA_SEQ_NUM key (with an UPDATE_NUM optimistic-concurrency check) from SUBPOENA, executed via IUnitOfWork.GetRepository<T>().Delete(...) from Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L87) in SubpoenaSaveService.DeleteSubpoena. The SQL below is inferred from this repository call and the NHibernate SubpoenaMap mapping — it is not literal SQL present in source.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-392 |
| Operation type | Delete |
| Execution method | ORM (IRepository.Delete) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | Subpoena |
| Criteria property | N/A — ORM |
| Lifecycle method | DeleteSubpoena |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long | N/A | Identifier of the Subpoena being deleted (SUBPOENA_SEQ_NUM) |
:oldVersion |
Input | int | N/A | Current UPDATE_NUM value (optimistic-concurrency check) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| SUBPOENA | DELETE | SUBPOENA_SEQ_NUM, UPDATE_NUM |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:87
// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:87
_unitOfWork.GetRepository<SubpoenaData.Subpoena>()
.Delete(subpoena);
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.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
DELETE FROM SUBPOENA
WHERE SUBPOENA_SEQ_NUM = :Id
AND UPDATE_NUM = :oldVersion
Translation notes:
Version(x => x.UpdateNumber).Column("UPDATE_NUM")adds the old-version predicate to the DELETE.HasMany(x => x.Recipients).KeyColumn("SUBPOENA_SEQ_NUM").Cascade.AllDeleteOrphan()(lines 50-53) - recipient deletes cascade; not fabricated.- Entity loaded at line 84 (separate read).
Operations and processes¶
- SubpoenaSaveService.DeleteSubpoena — see Operations and processes
Sources¶
Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L87)