Interface CustomerRepository

All Superinterfaces:
org.springframework.data.repository.CrudRepository<Customer,String>, org.springframework.data.jpa.repository.JpaRepository<Customer,String>, org.springframework.data.repository.ListCrudRepository<Customer,String>, org.springframework.data.repository.ListPagingAndSortingRepository<Customer,String>, org.springframework.data.repository.PagingAndSortingRepository<Customer,String>, org.springframework.data.repository.query.QueryByExampleExecutor<Customer>, org.springframework.data.repository.Repository<Customer,String>

public interface CustomerRepository extends org.springframework.data.jpa.repository.JpaRepository<Customer,String>
  • Method Summary

    Modifier and Type
    Method
    Description
     
    org.springframework.data.domain.Page<Customer>
    search(String keyword, org.springframework.data.domain.Pageable pageable)
     

    Methods inherited from interface org.springframework.data.repository.CrudRepository

    count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findById, save

    Methods inherited from interface org.springframework.data.jpa.repository.JpaRepository

    deleteAllByIdInBatch, deleteAllInBatch, deleteAllInBatch, deleteInBatch, findAll, findAll, flush, getById, getOne, getReferenceById, saveAllAndFlush, saveAndFlush

    Methods inherited from interface org.springframework.data.repository.ListCrudRepository

    findAll, findAllById, saveAll

    Methods inherited from interface org.springframework.data.repository.ListPagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

    findAll

    Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

    count, exists, findAll, findBy, findOne
  • Method Details

    • search

      @Query("SELECT c FROM Customer c WHERE c.name LIKE :keyword OR c.firstname LIKE :keyword OR c.nic LIKE :keyword ORDER BY c.firstname DESC") org.springframework.data.domain.Page<Customer> search(@Param("keyword") String keyword, org.springframework.data.domain.Pageable pageable)
    • checkIfNicExists

      @Query("select case when count(c)>0 then true else false END from Customer c where c.nic=?1") Boolean checkIfNicExists(String nic)