Interface CustomerRepository

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

@Repository public interface CustomerRepository extends org.springframework.data.jpa.repository.JpaRepository<Customer,Long>
Repositorio JPA para la entidad Customer.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Verifica si existe un cliente con el email dado.
    Busca un cliente por su email.
    Busca clientes cuyo nombre o apellido contenga el texto dado.
    Busca clientes por estado.

    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

    • findByEmail

      Optional<Customer> findByEmail(String email)
      Busca un cliente por su email.
      Parameters:
      email - email del cliente
      Returns:
      Optional con el cliente si existe
    • findByStatus

      List<Customer> findByStatus(Customer.CustomerStatus status)
      Busca clientes por estado.
      Parameters:
      status - estado del cliente
      Returns:
      lista de clientes con ese estado
    • findByFirstNameContainingOrLastNameContaining

      List<Customer> findByFirstNameContainingOrLastNameContaining(String firstName, String lastName)
      Busca clientes cuyo nombre o apellido contenga el texto dado.
      Parameters:
      firstName - texto a buscar en el nombre
      lastName - texto a buscar en el apellido
      Returns:
      lista de clientes que coinciden
    • existsByEmail

      boolean existsByEmail(String email)
      Verifica si existe un cliente con el email dado.
      Parameters:
      email - email a verificar
      Returns:
      true si existe, false en caso contrario