SQL-049: Create Subpoena via SaveSubpoena¶
This ORM statement performs a create operation on Subpoena via SaveSubpoena, executed from Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L142).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-049 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | Subpoena |
| Criteria property | N/A — ORM |
| Lifecycle method | SaveSubpoena |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long |
N/A | Identifier from SUBPOENA_SEQ.NEXTVAL |
:UpdateNumber |
Input | int |
N/A | Version column (Version()); NHibernate writes its initial value |
:SubpoenaText |
Input | string |
N/A | |
:SubpoenaOpeningText |
Input | string |
N/A | |
:ShowAppearanceInstructions |
Input | bool |
N/A | Bound as 'Y'/'N' (YesNoType) |
:IssueDate |
Input | DateTime |
N/A | |
:RequestedByEmployeeId |
Input | string |
N/A | |
:ApprovedDate |
Input | DateTime? |
N/A | |
:ApprovedByEmployeeId |
Input | string |
N/A | |
:AppearanceDateTime |
Input | DateTime |
N/A | |
:ComplianceDate |
Input | DateTime |
N/A | |
:BodyPartDescription |
Input | string |
N/A | |
:RecordsFromDate |
Input | DateTime? |
N/A | |
:RecordsThruDate |
Input | DateTime? |
N/A | |
:PageCount |
Input | long |
N/A | |
:SaifLocationFlag |
Input | bool |
N/A | Bound as 'Y'/'N' (YesNoType) |
:AdditionalClaimNumbers |
Input | string |
N/A | |
:AdditionalCaseNumbers |
Input | string |
N/A | |
:AKAName |
Input | string |
N/A | |
:ServeByDate |
Input | DateTime? |
N/A | |
:SpecificLocations |
Input | string |
N/A | |
:SpecialDeliveryText |
Input | string |
N/A | |
:ExternalFileNumber |
Input | string |
N/A | |
:CreateUser |
Input | string |
N/A | |
:CreateDate |
Input | DateTime |
N/A | |
:UpdateUser |
Input | string |
N/A | |
:UpdateDate |
Input | DateTime? |
N/A | |
:LegalCase |
Input | LegalCase |
N/A | Identifier of the referenced ? entity (References(x => x.LegalCase)) |
:SubpoenaStatus |
Input | SubpoenaStatus |
N/A | Identifier of the referenced SubpoenaStatus entity (References(x => x.SubpoenaStatus)) |
:SubpoenaType |
Input | SubpoenaType |
N/A | Identifier of the referenced SubpoenaType entity (References(x => x.SubpoenaType)) |
:HearingLocation |
Input | HearingLocation |
N/A | Identifier of the referenced ? entity (References(x => x.HearingLocation)) |
:SpecialHandling |
Input | SubpoenaSpecialHandling |
N/A | Identifier of the referenced SubpoenaSpecialHandling entity (References(x => x.SpecialHandling)) |
:ProcessServerLocation |
Input | ProviderLocation |
N/A | Identifier of the referenced ProviderLocation entity (References(x => x.ProcessServerLocation)) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| SUBPOENA | INSERT | SUBPOENA_SEQ_NUM, UPDATE_NUM, SUBPOENA_TEXT, SUBPOENA_OPENING_TEXT, SHOW_APPEARANCE_FLAG, ISSUE_DATE, REQUESTED_BY_EMPLID, APPROVED_DATE, APPROVED_BY_EMPLID, APPEARANCE_DATE_TIME, COMPLIANCE_DATE, BODY_PART_DESC, RECORDS_REQUEST_FROM_DATE, RECORDS_REQUEST_THRU_DATE, PAGE_COUNT, SAIF_LOCATION_FLAG, ADDITIONAL_CLAIM_NUMBERS, ADDITIONAL_CASE_NUMBERS, AKA_NAME, SERVE_BY_DATE, SPECIFIC_LOCATION_TEXT, SPECIAL_DELIVERY_TEXT, FILE_NUMBER, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, LEGAL_CASE_SEQ_NUM, SUBPOENA_STATUS_CODE, SUBPOENA_TYPE_CODE, HEARING_LOCATION_SEQ_NUM, SPECIAL_HANDLING_CODE, PROCESS_SERVER_LOC_SEQ_NUM (identifier from sequence SUBPOENA_SEQ.NEXTVAL) |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:142.
// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:142
_unitOfWork.GetRepository<SubpoenaData.Subpoena>().Add(dataSubpoena);
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 SUBPOENA_SEQ.NEXTVAL
FROM DUAL
INSERT INTO SUBPOENA (
SUBPOENA_SEQ_NUM,
UPDATE_NUM,
SUBPOENA_TEXT,
SUBPOENA_OPENING_TEXT,
SHOW_APPEARANCE_FLAG,
ISSUE_DATE,
REQUESTED_BY_EMPLID,
APPROVED_DATE,
APPROVED_BY_EMPLID,
APPEARANCE_DATE_TIME,
COMPLIANCE_DATE,
BODY_PART_DESC,
RECORDS_REQUEST_FROM_DATE,
RECORDS_REQUEST_THRU_DATE,
PAGE_COUNT,
SAIF_LOCATION_FLAG,
ADDITIONAL_CLAIM_NUMBERS,
ADDITIONAL_CASE_NUMBERS,
AKA_NAME,
SERVE_BY_DATE,
SPECIFIC_LOCATION_TEXT,
SPECIAL_DELIVERY_TEXT,
FILE_NUMBER,
CREATE_USER,
CREATE_DATE,
UPDATE_USER,
UPDATE_DATE,
LEGAL_CASE_SEQ_NUM,
SUBPOENA_STATUS_CODE,
SUBPOENA_TYPE_CODE,
HEARING_LOCATION_SEQ_NUM,
SPECIAL_HANDLING_CODE,
PROCESS_SERVER_LOC_SEQ_NUM)
VALUES (
:Id,
:UpdateNumber,
:SubpoenaText,
:SubpoenaOpeningText,
:ShowAppearanceInstructions,
:IssueDate,
:RequestedByEmployeeId,
:ApprovedDate,
:ApprovedByEmployeeId,
:AppearanceDateTime,
:ComplianceDate,
:BodyPartDescription,
:RecordsFromDate,
:RecordsThruDate,
:PageCount,
:SaifLocationFlag,
:AdditionalClaimNumbers,
:AdditionalCaseNumbers,
:AKAName,
:ServeByDate,
:SpecificLocations,
:SpecialDeliveryText,
:ExternalFileNumber,
:CreateUser,
:CreateDate,
:UpdateUser,
:UpdateDate,
:LegalCase,
:SubpoenaStatus,
:SubpoenaType,
:HearingLocation,
:SpecialHandling,
:ProcessServerLocation)
Translation notes:
- :Id is the value fetched from sequence SUBPOENA_SEQ (GeneratedBy.Native("SUBPOENA_SEQ")) before the INSERT; NHibernate assigns it to Subpoena.Id.
- UPDATE_NUM is the optimistic-concurrency version column (Version(x => x.UpdateNumber)); NHibernate sets its initial value on INSERT.
- :ShowAppearanceInstructions, :SaifLocationFlag 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; SubpoenaStatus → SUBPOENA_STATUS_CODE (entity table SUBPOENA_STATUS_CODE not accessed); SubpoenaType → SUBPOENA_TYPE_CODE (entity table SUBPOENA_TYPE_CODE not accessed); HearingLocation → HEARING_LOCATION_SEQ_NUM; SpecialHandling → SPECIAL_HANDLING_CODE (entity table SUBPOENA_SPECIAL_HANDLING_CODE not accessed); ProcessServerLocation → PROCESS_SERVER_LOC_SEQ_NUM (entity table PROVIDER_LOCATION not accessed).
- Cascade: HasMany(x => x.Recipients) is mapped with Cascade.AllDeleteOrphan(); any transient instances in that association are saved in their own statements (not fabricated here).
Operations and processes¶
- SubpoenaSaveService.SaveSubpoena — see Operations and processes
Business rules¶
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L142)