package org.hso.ecommerce.db;

import org.hso.ecommerce.entities.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CustomerRepository extends JpaRepository<Customer, Long> {

    @Query("SELECT c FROM Customer c WHERE c.lastname = :lastname")
    List<Customer> findByLastname(String lastname);

    @Query("SELECT c FROM Customer c WHERE c.username = :username")
    List<Customer> findByUsername(String username);
}


