An insert is a database write description representing the creation of a new record. It pairs a table name with a TableRecord and remains separate from an update. section 10.1.1
An insert carries the database library’s storage-level semantics:
- Collect inserts in a list when several new records must be written transactionally. section 10.1.1
- Represent the payload as a TableRecord mapping column names to values. section 10.1.1
- Expect a failure when an insert targets a record that already exists. section 10.4.6
Writing account records
List<Insert> inserts = List.of( new Insert("ACCOUNTS", accountRecord), new Insert("ACCOUNTS", anotherAccountRecord) ); database.transact(inserts, List.of()); The application can keep the insert construction at the boundary while expressing a higher-level operation such as upsert internally. section 10.1.1 section 10.4.6
Listing 10.3 Data types used for making changes
record Insert(String table, TableRecord record){}
record Update(String table, TableRecord record){}
Use the compact Java definition to see how Insert differs structurally from Update while sharing the same TableRecord payload. section 10.1.1


