Skip to content

SQL-041: Create PolicyOutputDocument via AddPolicyOutputDocument

This ORM statement performs a create operation on PolicyOutputDocument via AddPolicyOutputDocument, executed from Services/SAIF.Services/OutputDocuments/PolicyDocumentsService.cs (L561).

Classification

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

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A Identifier copied from the associated OutputDocument
:UpdateNumber Input int N/A Version column (Version()); NHibernate writes its initial value
:PolicyPeriodEffectiveDate Input DateTime? N/A
:AgencyId Input long? N/A
:AgentId Input long? N/A
:AgencyViewed Input bool N/A Bound as 'Y'/'N' (YesNoType)
:AgencyDelivery Input bool N/A Bound as 'Y'/'N' (YesNoType)
:AgencyDeleteDate Input DateTime? N/A
:CreateUser Input string (inherited from external base class; type inferred) N/A
:CreateDate Input DateTime (inherited from external base class; type inferred) N/A
:UpdateUser Input string (inherited from external base class; type inferred) N/A
:UpdateDate Input DateTime (inherited from external base class; type inferred) N/A
:ReleaseDate Input DateTime? N/A
:HoldTaskId Input long? N/A
:TaskUser Input string N/A
:SourceKeyText Input string N/A
:AccountNumber Input string N/A
:Policy Input Policy N/A Identifier of the referenced Policy entity (References(x => x.Policy))
:DocumentStatus Input DocumentStatusCode N/A Identifier of the referenced DocumentStatusCode entity (References(x => x.DocumentStatus))

Tables

Table Access Columns used
policy_output_document INSERT output_document_seq_num, update_num, policy_period_eff_date, agency_seq_num, agent_num, agency_viewed_flag, agency_delivery_flag, agency_delete_date, create_user, create_date, update_user, update_date, release_date, hold_task_seq_num, task_user, source_key_text, ACCOUNT_NUM, policy_num, document_status_code

LINQ statement

Source: Services/SAIF.Services/OutputDocuments/PolicyDocumentsService.cs:561.

// Services/SAIF.Services/OutputDocuments/PolicyDocumentsService.cs:561
unitOfWork.GetRepository<PolicyOutputDocument>().Add(policyDoc);

Sample SQL

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 policy_output_document (
  output_document_seq_num,
  update_num,
  policy_period_eff_date,
  agency_seq_num,
  agent_num,
  agency_viewed_flag,
  agency_delivery_flag,
  agency_delete_date,
  create_user,
  create_date,
  update_user,
  update_date,
  release_date,
  hold_task_seq_num,
  task_user,
  source_key_text,
  ACCOUNT_NUM,
  policy_num,
  document_status_code)
VALUES (
  :Id,
  :UpdateNumber,
  :PolicyPeriodEffectiveDate,
  :AgencyId,
  :AgentId,
  :AgencyViewed,
  :AgencyDelivery,
  :AgencyDeleteDate,
  :CreateUser,
  :CreateDate,
  :UpdateUser,
  :UpdateDate,
  :ReleaseDate,
  :HoldTaskId,
  :TaskUser,
  :SourceKeyText,
  :AccountNumber,
  :Policy,
  :DocumentStatus)

Translation notes: - GeneratedBy.Foreign("OutputDocument"): :Id is copied from the identifier of the associated OutputDocument entity (one-to-one shared primary key); no sequence call is made for this table. - update_num is the optimistic-concurrency version column (Version(x => x.UpdateNumber)); NHibernate sets its initial value on INSERT. - :AgencyViewed, :AgencyDelivery are bound as 'Y' / 'N' (YesNoType). - Reference FK values are bound from the associated entity's identifier; the referenced tables are not read or joined by this statement: Policy → policy_num (entity table POLICY not accessed); DocumentStatus → document_status_code (entity table document_status_code not accessed). - policyDoc.OutputDocument is a transient OutputDocument (call site lines 550-560). HasOne(r => r.OutputDocument).Constrained() declares no cascade, but the foreign identifier generator saves the associated transient OutputDocument first in order to obtain its identifier; that INSERT into the OutputDocument table is a separate statement and is not fabricated here.

Operations and processes

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/OutputDocuments/PolicyDocumentsService.cs (L561)