@Query(value="SELECT * FROM clients c WHERE (:bankerId IS NULL OR c.id_banker = :bankerId)",
nativeQuery=true)
List<Client>findClientsByBankerId(Integer bankerId)
Finds clients for a banker or all if bankerId is null.
countClientsByNameandBankerId
@Query(value="SELECT COUNT(*) FROM clients c WHERE c.NOME = :clientNome AND c.COGNOME = :clientCognome AND c.ID_BANKER = :bankerId",
nativeQuery=true)
intcountClientsByNameandBankerId(String clientNome,
String clientCognome,
Integer bankerId)
Returns the number of clients with the same name and banker.
updateClient
@Transactional
@Modifying
@Query(value="UPDATE clients SET nome=:clientName, cognome=:clientCognome, id_banker=:bankerId WHERE id=:clientId",
nativeQuery=true)
intupdateClient(String clientName,
String clientCognome,
int clientId,
int bankerId)