@Repository
public class CustomerDao {
@Autowired
private CustomerRepository repository;
public Customer saveCustomer(Customer customer)
{
return repository.save(customer);
}
public Customer updateCustomer(Customer customer)
{
return repository.save(customer);
}
public void deleteCustomer(int id)
{
repository.deleteById(id);
}
public Optional<Customer> getCustomer(int id)
{
return repository.findById(id);
}
public List<Customer> getAll()
{
return repository.findAll();
}
}
Comments
Post a Comment
If you have any doubts, Please let me know