---
title: "SQL-281: PolicyExtensions.GenerateDefaultPolicies"
summary: Read operation for `PolicyExtensions.GenerateDefaultPolicies`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-281: PolicyExtensions.GenerateDefaultPolicies

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by `PolicyExtensions.GenerateDefaultPolicies`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-281 |
| **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** | `GenerateDefaultPolicies` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [POLICY_TEAM_FUNCTION](../database-tables.md#policy_team_function) | SELECT ×24 (hypothetical) | POLICY_NUM, TEAM_FUNCTION_CODE, UPDATE_DATE, UPDATE_USER, USER_NAME |

## LINQ statement

Source: `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63`.

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63
var polTeam = uow.GetRepository<PolicyTeamFunction>();

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:96
policy.TeamFunctions = polTeam.Query().Where(tf => tf.PolicyNumber == i).ToList();
```

## Sample SQL

> **Test double — no runtime SQL.** This statement executes against `TestUnitOfWork`/`TestRepository<T>` (in-memory, `List<TEntity>`-backed test doubles in `SAIF.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 NHibernate `IUnitOfWork` using 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.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  PTF.POLICY_NUM,
  PTF.TEAM_FUNCTION_CODE,
  PTF.UPDATE_DATE,
  PTF.UPDATE_USER,
  PTF.USER_NAME
FROM POLICY_TEAM_FUNCTION PTF
WHERE PTF.POLICY_NUM = :i
```

Translation notes:
- Scope split: see SQL-248 — this entry documents the read at line 96.
- Not accessed: `WcisEmployee` target — `References(WcisEmployee).Column("USER_NAME")` contributes the FK column only.
- Issued once per loop iteration (`i` = 1..24); a real session would auto-flush the pending INSERT (SQL-248) before this query.

## Sources

- `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:63`
