Skip to content

SQL-395: Delete Transaction via DeleteTransaction

This statement deletes the Transaction entity identified by its LEGAL_COLL_TRAN_SEQ_NUM key (with an UPDATE_NUM optimistic-concurrency check) from LEGAL_COLLECTION_TRANSACTION, executed via IUnitOfWork.GetRepository<T>().Delete(...) from Services/SAIF.Services/Collections/CollectionsService.cs (L1619) in CollectionsService.DeleteTransaction. The SQL below is inferred from this repository call and the NHibernate TransactionMap mapping — it is not literal SQL present in source.

Classification

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

Parameters

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

Tables

Table Access Columns used
LEGAL_COLLECTION_TRANSACTION DELETE LEGAL_COLL_TRAN_SEQ_NUM, UPDATE_NUM

LINQ statement

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

// Services/SAIF.Services/Collections/CollectionsService.cs:1619
UnitOfWork.GetRepository<DataModel.Transaction>()
    .Delete(trans);

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_TRANSACTION
WHERE LEGAL_COLL_TRAN_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 GetTransactionData(id) (line 1615, see SQL-343). The subsequent changes to trans.Case (lines 1621-1623) are flushed on Commit() as an UPDATE LEGAL_COLLECTION - not fabricated here.

Operations and processes

Sources

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