Skip to content

SQL-341: Retrieve ThirdPartyCase via GenerateThirdPartyDebtor

This ORM statement performs a read operation on ThirdPartyCase, retrieving the first row where ClaimId matches, via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Collections/CollectionsService.cs (L1045). The SQL below is inferred from the LINQ expression and the ThirdPartyCase NHibernate mapping (THRDPARTY_CASE); it is not literal SQL text present in source.

Classification

Field Value
SQL ID SQL-341
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object ThirdPartyCase
Criteria property N/A — ORM
Lifecycle method GenerateThirdPartyDebtor

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A Captured member claimData.Id (claim returned by _ccClaimApiService.GetClaim)

Tables

Table Access Columns used
THRDPARTY_CASE SELECT THRDPARTY_CASE_SEQ_NUM, UPDATE_SEQ_NUM, CLAIM_ID, ACCIDENT_LOCATION_TEXT, SUBSEQ_INTERVENING_CAUSE_DATE, STATUTE_DATE, SUIT_FILED_DATE, CREATE_DATE, CREATE_USER, UPDATE_DATE, UPDATE_USER, THRDPARTY_ADJUSTER_CODE, THRDPARTY_STATUS_CODE, THRDPARTY_TYPE_CODE, SUBSEQ_INTERVENING_CAUSE_CODE, CAUSE_OF_ACTION_CODE, PLAINTIFF_FIRM_SEQ_NUM, COCOUNSEL_FIRM_SEQ_NUM

LINQ statement

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

// Services/SAIF.Services/Collections/CollectionsService.cs:1045
var caseId = UnitOfWork.GetRepository<ThirdPartyCase>().Query()
          .First(x => x.ClaimId == claimData.Id).ID;

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
SELECT *
FROM (
  SELECT
    TC.THRDPARTY_CASE_SEQ_NUM,
    TC.UPDATE_SEQ_NUM,
    TC.CLAIM_ID,
    TC.ACCIDENT_LOCATION_TEXT,
    TC.SUBSEQ_INTERVENING_CAUSE_DATE,
    TC.STATUTE_DATE,
    TC.SUIT_FILED_DATE,
    TC.CREATE_DATE,
    TC.CREATE_USER,
    TC.UPDATE_DATE,
    TC.UPDATE_USER,
    TC.THRDPARTY_ADJUSTER_CODE,
    TC.THRDPARTY_STATUS_CODE,
    TC.THRDPARTY_TYPE_CODE,
    TC.SUBSEQ_INTERVENING_CAUSE_CODE,
    TC.CAUSE_OF_ACTION_CODE,
    TC.PLAINTIFF_FIRM_SEQ_NUM,
    TC.COCOUNSEL_FIRM_SEQ_NUM
  FROM THRDPARTY_CASE TC
  WHERE TC.CLAIM_ID = :Id
)
WHERE ROWNUM <= 1

Translation notes:

  • First(...) -> Oracle10 ROWNUM <= 1 wrapper; .ID is read in memory after materialization.
  • HasMany(CompanionClaims) / HasMany(StatusHistories) are collections and are not selected.

Operations and processes

Sources

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