Skip to content

SQL-368: Delete Debtor via DeleteDebtor

This statement deletes the Debtor entity identified by its identifier (LEGAL_COLL_DEBTOR_SEQ_NUM) via IUnitOfWork.GetRepository<T>().Delete(entity), invoked from CollectionsService.DeleteDebtor (Services/SAIF.Services/Collections/CollectionsService.cs:622). Because the map declares a Version column, the deletion also carries an optimistic-concurrency check on UPDATE_NUM. The SQL below is inferred from this repository call and the Debtor NHibernate mapping — it is not literal SQL present in source.

Classification

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

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A Identifier of the Debtor being deleted (LEGAL_COLL_DEBTOR_SEQ_NUM)
:oldVersion Input int N/A Current UPDATE_NUM value (optimistic-concurrency check)

Tables

Table Access Columns used
LEGAL_COLLECTION_DEBTOR DELETE LEGAL_COLL_DEBTOR_SEQ_NUM, UPDATE_NUM

LINQ statement

Source: Services/SAIF.Services/Collections/CollectionsService.cs:622

// Services/SAIF.Services/Collections/CollectionsService.cs:622
UnitOfWork.GetRepository<DataModel.Debtor>().Delete(debtorData);

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_COLLECTION_DEBTOR
WHERE LEGAL_COLL_DEBTOR_SEQ_NUM = :Id
  AND UPDATE_NUM = :oldVersion

Translation notes:

  • Version(x => x.UpdateNum).Column("UPDATE_NUM") adds the old-version predicate to the DELETE.
  • Entity loaded by GetDebtorData(id) (line 614). The Location delete at line 620 is SQL-384.
  • Collections/DebtorMap.cs (csproj line 458) is authoritative; the CollectionsMap.cs duplicate is not compiled.

Operations and processes

Sources

  • Services/SAIF.Services/Collections/CollectionsService.cs (L622)