Skip to content

SQL-004: Batch insert (EbillBatch, with clearinghouse)

This Batch constructor overload builds a new EbillBatch with status "NEW", the supplied type, clearinghouse, submission date, and clearinghouse file name, then adds it to the repository.

Classification

Field Value
SQL ID SQL-004
Operation type Create
Execution method ORM (IRepository.Add)
Database Oracle*
Schema [unqualified]**
Command type N/A — ORM (NHibernate generates SQL at runtime from the ClassMaps in Data/SAIF.Data.NHibernate/Mappings/**)
Business object Batch
Criteria property N/A — ORM
Lifecycle method Batch

Tables

Table Access Columns used
EBILL_BATCH INSERT EBILL_BATCH_SEQ_NUM, UPDATE_NUM, CREATE_DATE, SUBMISSION_DATE, UPDATE_DATE, UPDATE_USER, CLEARINGHOUSE_FILE_NAME, EBILL_BATCH_TYPE_CODE, RESPONSE_BATCH_SEQ_NUM, EBILL_BATCH_STATUS_CODE, PAYMENT_TRANS_STAT_SEQ_NUM, EBILL_CLEARINGHOUSE_SEQ_NUM

LINQ statement

Source: Domain/SAIF.Domain/Model/Claims/Ebilling/Batch.cs:65

// Domain/SAIF.Domain/Model/Claims/Ebilling/Batch.cs:53-65
DataItem = new EbillBatch()
{
    Type = type,
    Status = _ebillingQueryProvider.BatchQueries.GetBatchStatus("NEW"),
    ClearinghouseFileName = fileName,
    SubmissionDate = (submissionDate == default(DateTime)) ? currentDate : submissionDate,
    Clearinghouse = clearinghouse,
    CreateDate = currentDate,
    UpdateDate = currentDate,
    UpdateUser = profileService.GetCurrentUser().UserId
};

Factory.GetRepository<EbillBatch>().Add(DataItem);

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

INSERT INTO EBILL_BATCH (
  EBILL_BATCH_SEQ_NUM,
  UPDATE_NUM,
  CREATE_DATE,
  SUBMISSION_DATE,
  UPDATE_DATE,
  UPDATE_USER,
  CLEARINGHOUSE_FILE_NAME,
  EBILL_BATCH_TYPE_CODE,
  RESPONSE_BATCH_SEQ_NUM,
  EBILL_BATCH_STATUS_CODE,
  PAYMENT_TRANS_STAT_SEQ_NUM,
  EBILL_CLEARINGHOUSE_SEQ_NUM)
VALUES (
  :Id,
  :UpdateNumber,
  :CreateDate,
  :SubmissionDate,
  :UpdateDate,
  :UpdateUser,
  :ClearinghouseFileName,
  :Type,
  :ResponseBatch,
  :Status,
  :PaymentStatistic,
  :Clearinghouse)

Translation notes: - :Id is the value fetched from EBILL_BATCH_SEQ (GeneratedBy.Native("EBILL_BATCH_SEQ") on Oracle). - :UpdateNumber is the initial version value NHibernate seeds on insert (version column mapped with Version(...)). - Reference bind variables (:<Property>) carry the referenced entity's identifier value. - The C# code assigns DateTime.Now client-side before flush; the value is bound as an ordinary parameter (no server date function). - Clearinghouse constructor: :Clearinghouse is set; :ResponseBatch, :PaymentStatistic are NULL. - Status is obtained from GetBatchStatus("NEW") — a separate query-provider read, not part of this SQL ID.

Operations and processes

Business rules

Note: Statements marked with * were inferred from code structure, naming conventions, or contextual evidence where direct confirmation was not available in source artifacts. Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Domain/SAIF.Domain/Model/Claims/Ebilling/Batch.cs