Skip to content

SQL-033: Create LegalBill via SaveLegalBill

This ORM statement performs a create operation on LegalBill via SaveLegalBill, executed from Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L383).

Classification

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

Parameters

Parameter Direction Type Max length Description
:Id Input long N/A Identifier from LEGAL_BILL_SEQ.NEXTVAL
:UpdateNumber Input int N/A Version column (Version()); NHibernate writes its initial value
:IssueDate Input DateTime N/A
:ReceivedDate Input DateTime N/A
:ApprovedDate Input DateTime? N/A
:RequestedByEmployeeId Input String N/A
:ApprovedByEmployeeId Input String N/A
:InvoiceText Input String N/A
:Comment Input String N/A
:IsPrepayment Input bool N/A Bound as 'Y'/'N' (YesNoType)
:CreateUser Input string N/A
:CreateDate Input DateTime N/A
:UpdateUser Input string N/A
:UpdateDate Input DateTime? N/A
:WitnessInformation Input string N/A
:ParentBillId Input long? N/A
:LegalCase Input LegalCase N/A Identifier of the referenced ? entity (References(x => x.LegalCase))
:BillStatus Input BillStatus N/A Identifier of the referenced BillStatus entity (References(x => x.BillStatus))
:BillingProvider Input ProviderLocation N/A Identifier of the referenced ProviderLocation entity (References(x => x.BillingProvider))
:RenderingProvider Input ProviderLocation N/A Identifier of the referenced ProviderLocation entity (References(x => x.RenderingProvider))
:SpecialHandling Input SpecialHandlingCode N/A Identifier of the referenced SpecialHandlingCode entity (References(x => x.SpecialHandling))

Tables

Table Access Columns used
LEGAL_BILL INSERT LEGAL_BILL_SEQ_NUM, UPDATE_NUM, ISSUE_DATE, RECEIVED_DATE, APPROVED_DATE, REQUESTED_BY_EMPLID, APPROVED_BY_EMPLID, INVOICE_TEXT, COMMENT_TEXT, PREPAYMENT_FLAG, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, WITNESS_INFORMATION, PARENT_LEGAL_BILL_SEQ_NUM, LEGAL_CASE_SEQ_NUM, BILL_STATUS_CODE, BILLING_PROV_LOC_SEQ_NUM, RENDERING_PROV_LOC_SEQ_NUM, SPECIAL_HANDLING_CODE (identifier from sequence LEGAL_BILL_SEQ.NEXTVAL)

LINQ statement

Source: Services/SAIF.Services/Legal/Bills/BillSaveService.cs:383.

// Services/SAIF.Services/Legal/Bills/BillSaveService.cs:383
_unitOfWork.GetRepository<BillData.LegalBill>().Add(legalBill);

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

INSERT INTO LEGAL_BILL (
  LEGAL_BILL_SEQ_NUM,
  UPDATE_NUM,
  ISSUE_DATE,
  RECEIVED_DATE,
  APPROVED_DATE,
  REQUESTED_BY_EMPLID,
  APPROVED_BY_EMPLID,
  INVOICE_TEXT,
  COMMENT_TEXT,
  PREPAYMENT_FLAG,
  CREATE_USER,
  CREATE_DATE,
  UPDATE_USER,
  UPDATE_DATE,
  WITNESS_INFORMATION,
  PARENT_LEGAL_BILL_SEQ_NUM,
  LEGAL_CASE_SEQ_NUM,
  BILL_STATUS_CODE,
  BILLING_PROV_LOC_SEQ_NUM,
  RENDERING_PROV_LOC_SEQ_NUM,
  SPECIAL_HANDLING_CODE)
VALUES (
  :Id,
  :UpdateNumber,
  :IssueDate,
  :ReceivedDate,
  :ApprovedDate,
  :RequestedByEmployeeId,
  :ApprovedByEmployeeId,
  :InvoiceText,
  :Comment,
  :IsPrepayment,
  :CreateUser,
  :CreateDate,
  :UpdateUser,
  :UpdateDate,
  :WitnessInformation,
  :ParentBillId,
  :LegalCase,
  :BillStatus,
  :BillingProvider,
  :RenderingProvider,
  :SpecialHandling)

Translation notes: - :Id is the value fetched from sequence LEGAL_BILL_SEQ (GeneratedBy.Native("LEGAL_BILL_SEQ")) before the INSERT; NHibernate assigns it to LegalBill.Id. - UPDATE_NUM is the optimistic-concurrency version column (Version(x => x.UpdateNumber)); NHibernate sets its initial value on INSERT. - :IsPrepayment 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: LegalCase → LEGAL_CASE_SEQ_NUM; BillStatus → BILL_STATUS_CODE (entity table BILL_STATUS_CODE not accessed); BillingProvider → BILLING_PROV_LOC_SEQ_NUM (entity table PROVIDER_LOCATION not accessed); RenderingProvider → RENDERING_PROV_LOC_SEQ_NUM (entity table PROVIDER_LOCATION not accessed); SpecialHandling → SPECIAL_HANDLING_CODE (entity table CL_PAYMENT_SPCL_HANDLING_CODE not accessed). - Cascade: HasMany(x => x.BillServices) is mapped with Cascade.AllDeleteOrphan(); any transient instances in that association are saved in their own statements (not fabricated here). - Cascade: HasMany(x => x.BillStatusHistories) is mapped with Cascade.AllDeleteOrphan(); any transient instances in that association are saved in their own statements (not fabricated here).

Operations and processes

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

Sources

  • Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L383)