Delete By Id
Definition
The deleteById
method allows you to delete one record of a table filtered by its primary key.
Available methods
deleteById(Y id)
: Receives a primary key value.deleteById(String jdbc, Y id)
: Receives the name of datasource connection to which you need to connect and a primary key value.deleteById(Y id, KColumnAllowedToReturning... selects)
: Receives a primary key value and a variable quantity of columns and values that will be added to theRETURNING
clause. Among the possible values are:KTableColumn
,KColumn
,Columns with alias
,KRaw
,Case conditional expression
.deleteById(String jdbc, Y id, KColumnAllowedToReturning... selects)
: Receives the name of datasource connection to which you need to connect, a primary key value and a variable quantity of columns and values that will be added to theRETURNING
clause. Among the possible values are:KTableColumn
,KColumn
,Columns with alias
,KRaw
,Case conditional expression
.
Example: Y
Java code:
languageRepository.deleteById(11L);
SQL generated:
DELETE
FROM language la
WHERE la.id = ?1
Parameters:
- ?1: 11
Example: String, Y
Java code:
languageRepository.deleteById(
K.JDBC_LEGACY,
11L
);
SQL generated:
DELETE
FROM language la
WHERE la.id = ?1
Parameters:
- ?1: 11
Example: Y, KColumnAllowedToReturning...
Java code:
final Language language = languageRepository.deleteById(
11L,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
DELETE
FROM language la
WHERE la.id = ?1
RETURNING
la.name,
la.file
Parameters:
- ?1: 11
Example: String, Y, KColumnAllowedToReturning...
Java code:
final Language language = languageRepository.deleteById(
K.JDBC_LEGACY,
11L,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
DELETE
FROM language la
WHERE la.id = ?1
RETURNING
la.name,
la.file
Parameters:
- ?1: 11