Documentation for the "inserters" JSON key.

Inserters are simple SQL statements to insert a row into the database with the need to create a java POJO model. These are most useful when reading from an external data source for mass insertions without the need to manipulate the data once it has been read.

This is a light-weight way to insert data without the need for a full java object

The key inserters is a JSON Array on the table JSON object, for example:

"tables": [
	{
		"fields": [
			...
		],
		"inserters": [
			...
		]
	}
]

Allowable keys for a Inserter JSON Object

key namekey value typeusagenotes
nameStringmandatoryThis is the name for the inserters. If not present on the JSON object an H2ZeroParseException will be thrown.
selectClauseStringoptionalFor general SQL interactions: By default, the select query will be a select * from <table_name>, If you wish to over-ride this default behaviour, then this is the SQL query that will be run.

For inserters SQL interactions: This is the SQL query that is used to insert the values for the table. This may also be a cross-table select.

In the case of inserters the select clause MUST have a field for all non-nullable fields for the inserter and may select from other tables.
selectFieldsJSON Array (String)invalidSelect fields are invalid for the inserters JSON object.
insertClauseJSON ArrayoptionalThe insert clause is only valid for inserters and cannot be used for any other SQL interaction.

By default, the insert clause will be a generated with all of the fields from the <table_name>, however this may be over-ridden to include only non-nullable fields.

If you wish to over-ride this default behaviour, then this is the SQL query that will be run.
whereClauseStringinvalidUsed if the SQL query is parameterised.
whereFieldsJSON Array (String)invalidThe name for each of the whereClause parameters.

If there is a whereFields key on the JSON object without any whereClause then this will generate a FATAL validation message.
uniqueboolean (default false)ignoredWhether the SQL query will return a single object or an List of objects.

This always returns one, and only one result in the result set of type boolean and is therefore un-necessary.