Skip to content

SQL-165: LegalQueryProvider.IsPrimaryCase

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by LegalQueryProvider.IsPrimaryCase.

Classification

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

Parameters

Parameter Direction Type Max length Description
caseId Input long N/A Method argument of LegalQueryProvider.IsPrimaryCase bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
CONSOLIDATED_CASE SELECT (existence) PRIMARY_CASE_SEQ_NUM

LINQ statement

Source: Data/SAIF.Data/Queries/Legal/LegalQueryProvider.cs:132.

public bool IsPrimaryCase(long caseId)
{
    return Factory.GetRepository<ConsolidatedCase>().Query().Any(x => x.PrimaryCase.Id == caseId);
}

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 1
  FROM CONSOLIDATED_CASE CC
  WHERE CC.PRIMARY_CASE_SEQ_NUM = :caseId
) WHERE ROWNUM <= 1

Translation notes: - NHibernate's LINQ provider implements Any(predicate) as a row-limited existence probe; true is returned when a row comes back. The exact projection NHibernate emits may differ (some versions select the Id column), but the semantics are the same.

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Legal/LegalQueryProvider.cs:132