Skip to content

SQL-161: LegalQueryProvider.GetAttorneyProfile

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

Classification

Field Value
SQL ID SQL-161
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 GetAttorneyProfile

Parameters

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

Tables

Table Access Columns used
ATTORNEY_PROFILE SELECT PROFILE_EMPLID, SECRETARY_EMPLID, MANAGER_EMPLID, OREGON_STATE_BAR_NUMBER, EFF_DATE, EXP_DATE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE

LINQ statement

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

public AttorneyProfile GetAttorneyProfile(string attorneyEmployeeId)
{
    return Factory.GetRepository<AttorneyProfile>().Query().FirstOrDefault(x => x.AttorneyEmployeeId == attorneyEmployeeId);
}

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
    AP.PROFILE_EMPLID,
    AP.SECRETARY_EMPLID,
    AP.MANAGER_EMPLID,
    AP.OREGON_STATE_BAR_NUMBER,
    AP.EFF_DATE,
    AP.EXP_DATE,
    AP.CREATE_USER,
    AP.CREATE_DATE,
    AP.UPDATE_USER,
    AP.UPDATE_DATE
  FROM ATTORNEY_PROFILE AP
  WHERE AP.PROFILE_EMPLID = :attorneyEmployeeId
) WHERE ROWNUM <= 1

Translation notes: - AttorneyEmployeeId is the Id (Id(x => x.AttorneyEmployeeId).Column("PROFILE_EMPLID")). - References(x => x.AttorneyEmployee) reuses PROFILE_EMPLID, so the column is selected once. The external Employee it points at is lazy and not queried here.

Operations and processes

Business rules

Sources

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