SQL-243: ClaimBuilder.Policy¶
This statement is a create operation invoked through ORM (IRepository.Add). Executed by ClaimBuilder.Policy.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-243 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | ClaimBuilder |
| Criteria property | N/A — ORM |
| Lifecycle method | Policy |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
number |
Input | long | N/A | Method argument of ClaimBuilder.Policy bound into the ORM expression; NHibernate generates the bind variable at runtime |
name |
Input | string | N/A | Method argument of ClaimBuilder.Policy bound into the ORM expression; NHibernate generates the bind variable at runtime |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| POLICY | SELECT (existence, hypothetical) | POLICY_NUM |
LINQ statement¶
Source: Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimBuilder.cs:107.
// Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimBuilder.cs:107-109
if (!name.IsNullOrWhiteSpace())
if (!Uow.GetRepository<Policy>().Query().Any(x => x.PolicyNumber == number))
Uow.GetRepository<Policy>().Add(new Policy { PolicyNumber = number, PolicyName = name });
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 1
FROM POLICY P
WHERE P.POLICY_NUM = :number)
WHERE ROWNUM <= 1
Translation notes:
- Scope split: SQL-243 and SQL-260 cite the same line (107). SQL-243 documents the existence check (Any, line 108); SQL-260 documents the INSERT (line 109).
- Any(predicate) → existence probe; Oracle has no EXISTS scalar in the select list, so NHibernate 4 emits a ROWNUM <= 1 probe (shape may vary: SELECT CASE WHEN EXISTS(...)).
- Only evaluated when name is non-blank (in-memory guard at line 107).
Sources¶
Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimBuilder.cs:107