Skip to content

SQL-024: GroupImageRepository.GetImageGroupOrDefault

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

Classification

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

Parameters

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

Tables

Table Access Columns used
Image_Group SELECT image_group_seq_num, group_association_code, image_seq_num

LINQ statement

Source: Data/SAIF.Data.NHibernate/Repositories/Groups/GroupImageRepository.cs:46. The queryable is obtained at Data/SAIF.Data.NHibernate/Repositories/Groups/GroupImageRepository.cs:93.

public ImageGroup GetImageGroupOrDefault(long groupImageId)
{
    return GroupImageQuery().SingleOrDefault(i => i.Id == groupImageId);
}

private IQueryable<ImageGroup> GroupImageQuery()
{
    return Session.Query<ImageGroup>();
}

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
  IG.image_group_seq_num,
  IG.group_association_code,
  IG.image_seq_num
FROM Image_Group IG
WHERE IG.image_group_seq_num = :groupImageId
-- NHibernate expects at most one row

Translation notes: - ImageGroup.Image (image_seq_num) and ImageGroup.Group (group_association_code) are lazy References; they resolve to already-selected FK columns and are not joined, so image and group_association are not accessed by this statement.

Operations and processes

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

Sources

  • Data/SAIF.Data.NHibernate/Repositories/Groups/GroupImageRepository.cs:46