Find By Ids
Definition
The findByIds
method allows you to get multiple records of a table filtered by its primary key.
Available methods
findByIds(List<Y> ids, KColumnAllowedToSelect... selects)
: Receives a list with multiple primary keys 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
.findByIds(String jdbc, List<Y> ids, KColumnAllowedToSelect... selects)
: Receives the name of datasource connection to which you need to connect, a list with multiple primary keys 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: List<Y>, KColumnAllowedToSelect...
Java code:
final ArrayList ids = new ArrayList();
ids.add(11L);
ids.add(16L);
final Language language = languageRepository.findByIds(
ids,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
SELECT la.name, la.file
FROM auth.language la
WHERE la.id IN (?1, ?2)
Parameters:
- ?1: 11
- ?2: 16
Example: String, List<Y>, KColumnAllowedToSelect...
Java code:
final ArrayList ids = new ArrayList();
ids.add(11L);
ids.add(16L);
final Language language = languageRepository.findByIds(
K.JDBC_LEGACY,
ids,
LANGUAGE.NAME,
LANGUAGE.FILE
);
SQL generated:
SELECT la.name, la.file
FROM auth.language la
WHERE la.id IN (?1, ?2)
Parameters:
- ?1: 11
- ?2: 16