Skip to content

SQL-244: ClaimCodeTableBuilder.ClaimResponsibility

This statement is a create operation invoked through ORM (IRepository.Add). Executed by ClaimCodeTableBuilder.ClaimResponsibility.

Classification

Field Value
SQL ID SQL-244
Operation type Create
Execution method ORM (IRepository.Add)
Database Oracle*
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object ClaimCodeTableBuilder
Criteria property N/A — ORM
Lifecycle method ClaimResponsibility

Tables

Table Access Columns used
CL_CLAIM_RESPONSIBILITY INSERT (hypothetical) CLAIM_RESP_CODE, CLAIM_RESP_USER, CLAIM_ASSISTANT_USER, PSEUDO_USER, PSEUDO_NAME, PSEUDO_PHONE, UPDATE_DATE, UPDATE_USER, UPDATE_NUM, CLAIM_SUPERVISOR_CODE, RESPONSIBILITY_TYPE_CODE

LINQ statement

Source: Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:85.

// Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:82-91
if (resp == null)
{
     resp = new ClaimResponsibility();
    _uow.GetRepository<ClaimResponsibility>().Add(resp);
}

resp.Code = code;
resp.ClaimAssistantMailId = assistantMailId;
resp.PseudoUser = mailId;
resp.Supervisor = new ClaimSupervisor {Code = "X", Section = region, MailId = supervisorMailId};

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.

-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
INSERT INTO CL_CLAIM_RESPONSIBILITY (
  CLAIM_RESP_CODE,
  CLAIM_RESP_USER,
  CLAIM_ASSISTANT_USER,
  PSEUDO_USER,
  PSEUDO_NAME,
  PSEUDO_PHONE,
  UPDATE_DATE,
  UPDATE_USER,
  UPDATE_NUM,
  CLAIM_SUPERVISOR_CODE,
  RESPONSIBILITY_TYPE_CODE)
VALUES (
  :Code,
  :MailId,
  :ClaimAssistantMailId,
  :PseudoUser,
  :PseudoName,
  :PseudoPhone,
  :UpdateDate,
  :UpdateUser,
  :UpdateNumber,
  :Supervisor,
  :ResponsibilityType)
-- properties assigned after Add (lines 88-91) are written by this INSERT at flush (or a follow-up UPDATE if flushed earlier)

Translation notes: - Scope split: SQL-244 and SQL-265 are the same method. SQL-244 documents the INSERT (line 85); SQL-265 documents the FirstOrDefault read (line 80). - Not accessed: CLAIM_SUPERVISOR — resp.Supervisor = new ClaimSupervisor {...} (line 91) sets a reference to a transient object; References(x => x.Supervisor) has no cascade, so no INSERT into CLAIM_SUPERVISOR is issued (a real session would throw TransientObjectException at flush). - Id(Code) column CLAIM_RESP_CODE is assigned (no generator), so the INSERT is deferred to flush and picks up the values set on lines 88-91.

Sources

  • Data/SAIF.Data/TestRepository/RepositoryBuilders/ClaimCodeTableBuilder.cs:85