Last active
April 27, 2017 12:45
-
-
Save edermfl/36d9c3a6c5d862e59939635b4c305096 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Repository | |
public interface ClienteRepository extends JpaRepository<Cliente, Long> { | |
public Cliente findByRg(String pRg); | |
public Cliente findByRgAndNome (String pRg, String pNome); | |
/** | |
* Usando JPql | |
* @param pPrimeiroNome | |
* @return lista de clientes com primeiro nome igual ao informado | |
*/ | |
@Query("SELECT c FROM Cliente c WHERE c.nome like ?1%") | |
public List<Cliente> findAllByFirstName(String pPrimeiroNome); | |
/** | |
* Usando SQL nativo | |
* @param pUltimoNome | |
* @return lista de clientes com último nome igual ao informado | |
*/ | |
@Query(value = "SELECT * FROM CLIENTE c WHERE c.NOME like %?1", nativeQuery = true) | |
public List<Cliente> findAllByLastName(String pUltimoNome); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment