Find By Id
Definition
The findById
method allows you to get one record of a table filtered by its primary key.
Available methods
findById(Y id, KColumnAllowedToSelect... selects)
: Receives a primary key value and a variable quantity of columns and values that will be added to theSELECT
list. Among the possible values are:KTableColumn
,KColumn
,Values
,KCondition
,Columns with over
,Columns with alias
,KRaw
,Case conditional expression
.findById(String jdbc, Y id, KColumnAllowedToSelect... 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 theSELECT
list. Among the possible values are:KTableColumn
,KColumn
,Values
,KCondition
,Columns with over
,Columns with alias
,KRaw
,Case conditional expression
.
Example: Y, KColumnAllowedToSelect...
Java code:
final Language language = languageRepository.findById(
11L,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
SELECT la.name, la.file
FROM auth.language la
WHERE la.id = ?1
Parameters:
- ?1: 11
Example: String, Y, KColumnAllowedToSelect...
Java code:
final Language language = languageRepository.findById(
K.JDBC_LEGACY,
11L,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
SELECT la.name, la.file
FROM auth.language la
WHERE la.id = ?1
Parameters:
- ?1: 11