Documentation for the "updater" JSON key.

Updaters are a way altering a single field on the underlying database

Rather than configuring setClause bean (more on this below) type queries, the following shortcut updater generators are also available:

fieldUpdaters
For simple updaters on either a single field, which will return the number of rows that have been updated.
"tables": [
	{
		"fields": [
			...
		],
		"updaters": [
			...
		]
	}
]

Allowable keys for a Updater JSON Object

key namekey value typeusagenotes
nameStringmandatoryThis is the name for the updater. If not present on the JSON object an H2ZeroParseException will be thrown.
setClauseStringmandatoryUsed for updaters only: You must provide a set clause which is valid SQL for inserting into the database.

This will generate a FATAL validation message if not present on the JSON object.
setFieldsJSON Array (String)mandatorySelect fields are mandatory for the updater JSON object.

One field for each of the replacement tokens ? in the SQL set clause.

This will generate a FATAL validation message if not present on the JSON object.
whereClauseStringoptionalUsed if the SQL query is parameterised.
whereFieldsJSON Array (String)optionalThe 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 is ignored, as updaters return the number of rows that have been updated as an integer.

Default Updaters

By default Updaters are designed to return the number of rows that have been updated

"updaters": [
	{
		"name": "updateFlIsIndexedByIdUser",
		"setClause": "set fl_is_indexed = ?"",
		"setFields": [
			"fl_is_indexed"
		],
		"whereClause": "where id_user = ?",
		"whereFields": [
			"id_user"
		]
	}]

This will update the fl_is_indexed to the passed in variable, where the id_user is equal to the passed in variable.

With the following method signatures

public static int updateFlIsIndexedByIdUser(Connection connection, Boolean flIsIndexedSet, Long idUser) throws SQLException
public static int updateFlIsIndexedByIdUser(Boolean flIsIndexedSet, Long idUser) throws SQLException
public static int updateFlIsIndexedByIdUserSilent(Boolean flIsIndexedSet, Long idUser)
Please see the method signatures page for information about usage patterns for the various method signatures that are generated.

If the "taglibs" option is enabled, this will also generate a tag library (and its associated entry in the TLD) file.