Skip to content

SQL-026: GroupRepository.GroupFound

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

Classification

Field Value
SQL ID SQL-026
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 GroupFound

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:21.

public bool GroupFound(string groupId)
{
    var group = GetGroupOrDefault(groupId);
    return group != null;
}

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: - Same database statement as SQL-027 (GroupFound delegates to GetGroupOrDefault). group != null is evaluated in memory. Query() is RepositoryBase<TEntity>.Query() → Session.Query<TEntity>() (SAIF.Framework.Data.NHibernate RepositoryBase<T>, package decompile). - 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:21