Skip to content

SQL-027: GroupRepository.GetGroupOrDefault

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

Classification

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

Parameters

Parameter Direction Type Max length Description
:groupId Input string N/A Method argument bound into the LINQ expression

Tables

Table Access Columns used
group_association SELECT code, code_descr, phone, code_acronym, association_exp_date, group_representative, group_type_code, parent_group

LINQ statement

Source: Data/SAIF.Data.NHibernate/Repositories/Groups/GroupRepository.cs:27.

public GroupAssociation GetGroupOrDefault(string groupId)
{
    return Query().SingleOrDefault(g => g.Id == groupId);
}

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
  GA.code,
  GA.code_descr,
  GA.phone,
  GA.code_acronym,
  GA.association_exp_date,
  GA.group_representative,
  GA.group_type_code,
  GA.parent_group
FROM group_association GA
WHERE GA.code = :groupId
-- NHibernate expects at most one row

Translation notes: - GroupAssociation.Type, .SAIFRepresentative, and .ParentGroup are lazy References; only their FK columns (group_type_code, group_representative, parent_group) are selected. ChildGroups is a lazy HasMany and is not selected.

Operations and processes

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Data/SAIF.Data.NHibernate/Repositories/Groups/GroupRepository.cs:27