SQL-280: PolicyExtensions.GenerateAgencies¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by PolicyExtensions.GenerateAgencies.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-280 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | PolicyExtensions |
| Criteria property | N/A — ORM |
| Lifecycle method | GenerateAgencies |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| Agency | SELECT (hypothetical) | agency_seq_num, agency_name, agency_eff_date, agency_exp_date, policy_holder_paperless_flag, agency_paperless_flag, agency_paperless_request_flag, update_date, update_user, agency_rep_user |
LINQ statement¶
Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30.
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30
var agencies = uow.GetRepository<Agency>();
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:56
agencies.Query().First().Id = 0; // this was necessary because the first agency id was automatically changed from 0 to 1 when adding it to list
Sample SQL¶
Test double — no runtime SQL. This statement executes against
TestUnitOfWork/TestRepository<T>(in-memory,List<TEntity>-backed test doubles inSAIF.Framework.Core); no NHibernate session is opened and no SQL is issued at runtime. The SQL below is the hypothetical statement the same expression would produce against a real NHibernateIUnitOfWorkusing the in-repo mappings, shown to document the mapping shape only — no database table is accessed when this code runs.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
A.agency_seq_num,
A.agency_name,
A.agency_eff_date,
A.agency_exp_date,
A.policy_holder_paperless_flag,
A.agency_paperless_flag,
A.agency_paperless_request_flag,
A.update_date,
A.update_user,
A.agency_rep_user
FROM Agency A)
WHERE ROWNUM <= 1
-- First(): throws if no row
Translation notes:
- Scope split: see SQL-246 — this entry documents the First() read at line 56.
- No OrderBy, so "first" is database-order dependent.
- .Id = 0 then mutates the identifier of a persistent entity — a real NHibernate session throws HibernateException: identifier of an instance was altered at flush. The source comment confirms this is a test-double workaround.
Sources¶
Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:30