SQL-034: Create LegalNote via CreateNote¶
This ORM statement performs a create operation on LegalNote via CreateNote, executed from Services/SAIF.Services/Legal/Notes/LegalNotesService.cs (L236).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-034 |
| Operation type | Create |
| Execution method | ORM (IRepository.Add) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | LegalNote |
| Criteria property | N/A — ORM |
| Lifecycle method | CreateNote |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Id |
Input | long |
N/A | Identifier from CASE_NOTE_SEQ.NEXTVAL |
:Text |
Input | string |
N/A | |
:CreateUser |
Input | string |
N/A | |
:CreateDate |
Input | DateTime |
N/A | |
:UpdateUser |
Input | string |
N/A | |
:UpdateDate |
Input | DateTime? |
N/A | |
:Category |
Input | LegalNoteCategory |
N/A | Identifier of the referenced LegalNoteCategory entity (References(x => x.Category)) |
:Case |
Input | LegalCase |
N/A | Identifier of the referenced LegalCase entity (References(x => x.Case)) |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| LEGAL.CASE_NOTE | INSERT | CASE_NOTE_SEQ_NUM, TEXT, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE, NOTE_CATEGORY_CODE, LEGAL_CASE_SEQ_NUM (identifier from sequence CASE_NOTE_SEQ.NEXTVAL) |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Notes/LegalNotesService.cs:236.
// Services/SAIF.Services/Legal/Notes/LegalNotesService.cs:236
UnitOfWork.GetRepository<LegalData.LegalNote>().Add(noteData);
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 CASE_NOTE_SEQ.NEXTVAL
FROM DUAL
INSERT INTO LEGAL.CASE_NOTE (
CASE_NOTE_SEQ_NUM,
TEXT,
CREATE_USER,
CREATE_DATE,
UPDATE_USER,
UPDATE_DATE,
NOTE_CATEGORY_CODE,
LEGAL_CASE_SEQ_NUM)
VALUES (
:Id,
:Text,
:CreateUser,
:CreateDate,
:UpdateUser,
:UpdateDate,
:Category,
:Case)
Translation notes:
- :Id is the value fetched from sequence CASE_NOTE_SEQ (GeneratedBy.Native("CASE_NOTE_SEQ")) before the INSERT; NHibernate assigns it to LegalNote.Id.
- Reference FK values are bound from the associated entity's identifier; the referenced tables are not read or joined by this statement: Category → NOTE_CATEGORY_CODE (entity table NOTE_CATEGORY_CODE not accessed); Case → LEGAL_CASE_SEQ_NUM.
- legalCase is loaded before line 222 and Category by a separate LegalNoteCategory SingleOrDefault lookup (LegalNotesService.cs:228-229); only their FK values are written.
Operations and processes¶
- LegalNotesService.CreateNote — see Operations and processes
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/Notes/LegalNotesService.cs (L236)