Skip to content

SQL-036: Create LegalPerson via CreateNewLegalPerson

This ORM statement performs a create operation on LegalPerson via CreateNewLegalPerson, executed from Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L317).

Classification

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

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A Identifier from LEGAL_PERSON_SEQ.NEXTVAL
:FirstName Input string N/A
:MiddleInitial Input string N/A
:LastName Input string N/A
:PreferredName Input string N/A
:CreateUser Input string N/A
:CreateDate Input DateTime N/A
:UpdateUser Input string N/A
:UpdateDate Input DateTime? N/A

Tables

Table Access Columns used
LEGAL_PERSON INSERT LEGAL_PERSON_SEQ_NUM, FIRST_NAME, MIDDLE_INITIAL, LAST_NAME, PREFERRED_NAME, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE (identifier from sequence LEGAL_PERSON_SEQ.NEXTVAL)

LINQ statement

Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:317.

// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:317
_unitOfWork.GetRepository<LegalData.LegalPerson>().Add(dataRecipient.LegalPerson);

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
SELECT LEGAL_PERSON_SEQ.NEXTVAL
FROM DUAL

INSERT INTO LEGAL_PERSON (
  LEGAL_PERSON_SEQ_NUM,
  FIRST_NAME,
  MIDDLE_INITIAL,
  LAST_NAME,
  PREFERRED_NAME,
  CREATE_USER,
  CREATE_DATE,
  UPDATE_USER,
  UPDATE_DATE)
VALUES (
  :Id,
  :FirstName,
  :MiddleInitial,
  :LastName,
  :PreferredName,
  :CreateUser,
  :CreateDate,
  :UpdateUser,
  :UpdateDate)

Translation notes: - :Id is the value fetched from sequence LEGAL_PERSON_SEQ (GeneratedBy.Native("LEGAL_PERSON_SEQ")) before the INSERT; NHibernate assigns it to LegalPerson.Id. - Cascade: HasOne(x => x.LegalPersonAddress) is mapped with Cascade.All(); any transient instances in that association are saved in their own statements (not fabricated here). - The Add is called on dataRecipient.LegalPerson; the owning recipient/subpoena rows are separate statements.

Operations and processes

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

Sources

  • Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L317)