SQL-382: Delete LegalBill via DeleteBill¶
This statement deletes the LegalBill entity identified by its LEGAL_BILL_SEQ_NUM key (with an UPDATE_NUM optimistic-concurrency check) from LEGAL_BILL, executed via IUnitOfWork.GetRepository<T>().Delete(...) from Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L105) in BillSaveService.DeleteBill. The SQL below is inferred from this repository call and the NHibernate LegalBillMap mapping — it is not literal SQL present in source.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-382 |
| Operation type | Delete |
| Execution method | ORM (IRepository.Delete) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | LegalBill |
| Criteria property | N/A — ORM |
| Lifecycle method | DeleteBill |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long | N/A | Identifier of the LegalBill being deleted (LEGAL_BILL_SEQ_NUM) |
:oldVersion |
Input | int | N/A | Current UPDATE_NUM value (optimistic-concurrency check) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| LEGAL_BILL | DELETE | LEGAL_BILL_SEQ_NUM, UPDATE_NUM |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Bills/BillSaveService.cs:105
// Services/SAIF.Services/Legal/Bills/BillSaveService.cs:105
_unitOfWork.GetRepository<BillData.LegalBill>()
.Delete(legalBill);
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 LEGAL_BILL
WHERE LEGAL_BILL_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(BillServices)andHasMany(BillStatusHistories)(keyLEGAL_BILL_SEQ_NUM) areCascade.AllDeleteOrphan()(lines 37-44) - child deletes cascade; not fabricated.- Entity loaded at line 100 (separate read).
Operations and processes¶
- BillSaveService.DeleteBill — see Operations and processes
Sources¶
Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L105)