SQL-261: ClaimCodeTableBuilder.Jurisdiction¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by ClaimCodeTableBuilder.Jurisdiction.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-261 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | ClaimCodeTableBuilder |
| Criteria property | N/A — ORM |
| Lifecycle method | Jurisdiction |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| CL_JURISDICTION_CODE | SELECT (existence) + INSERT ×9, SELECT, UPDATE (flush) (hypothetical) | CODE, CODE_DESCR, DOL_AUTHORIZATION_NUM, FEDERAL_DATA_FLAG, UPDATE_DATE, UPDATE_USER, UPDATE_NUM |
LINQ statement¶
Source: Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:32.
// Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:30-44
public IClaimCodeTableBuilder Jurisdiction()
{
var repo = _uow.GetRepository<JurisdictionCode>();
repo.AddCode("1", "State");
repo.AddCode("2", "Inmate Injury");
// ... 7 further Add/AddCode call(s) through line 44 (elided)
}
// Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:42
repo.Query().Where(x => !x.Code.IsIn("1", "2")).ForEach(code => code.IsFederal = true);
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
-- AddCode pattern (SharedExtensions.cs:26-27), issued 9 time(s); first call shown ('1', 'State')
SELECT *
FROM (
SELECT 1
FROM CL_JURISDICTION_CODE CJC
WHERE CJC.CODE = :code
AND CJC.CODE_DESCR = :description)
WHERE ROWNUM <= 1
-- only when the probe returns no row
INSERT INTO CL_JURISDICTION_CODE (
CODE,
CODE_DESCR,
DOL_AUTHORIZATION_NUM,
FEDERAL_DATA_FLAG,
UPDATE_DATE,
UPDATE_USER,
UPDATE_NUM)
VALUES (
:Code,
:Description,
:DolAuthorizationNumber,
:IsFederal,
:UpdateDate,
:UpdateUser,
:UpdateNumber)
-- line 42: repo.Query().Where(x => !x.Code.IsIn("1", "2"))
SELECT
CJC.CODE,
CJC.CODE_DESCR,
CJC.DOL_AUTHORIZATION_NUM,
CJC.FEDERAL_DATA_FLAG,
CJC.UPDATE_DATE,
CJC.UPDATE_USER,
CJC.UPDATE_NUM
FROM CL_JURISDICTION_CODE CJC
WHERE CJC.CODE NOT IN ('1', '2') -- only if IsIn is translatable (see notes)
-- line 42: .ForEach(code => code.IsFederal = true) -> dirty at flush, one per row
UPDATE CL_JURISDICTION_CODE
SET FEDERAL_DATA_FLAG = 'Y' -- YesNoType
-- dynamic-update=false: all mapped columns are written
WHERE CODE = :Code
Translation notes:
- IsIn(...) is a SAIF custom extension method, not a registered NHibernate LINQ generator; against a real NHibernate provider it would most likely throw NotSupportedException. The NOT IN form is the intended semantics, uncertain as a translation.
- AddCode pattern as described for SQL-266 (9 calls, lines 33-41).
Sources¶
Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:32