Skip to content

SQL-360: Delete Activity via DeleteActivity

This ORM statement deletes a LEGAL_COLLECTION_ACTIVITY row for a previously loaded legal collection activity, executed from Services/SAIF.Services/Collections/CollectionsService.cs (L1257). The SQL below is inferred from the IRepository<Activity>.Delete call and the Activity NHibernate mapping, not literal SQL text in source.

Classification

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

Parameters

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

Tables

Table Access Columns used
LEGAL_COLLECTION_ACTIVITY DELETE LEGAL_COLL_ACTIVITY_SEQ_NUM, UPDATE_NUM

LINQ statement

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

// Services/SAIF.Services/Collections/CollectionsService.cs:1257
UnitOfWork.GetRepository<DataModel.Activity>()
    .Delete(activity);

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_ACTIVITY
WHERE LEGAL_COLL_ACTIVITY_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 beforehand by GetActivityData(activityId) (line 1253) - that read is a separate statement.

Operations and processes

Sources

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