how to properly handle case when theres no records in the db table?

hey guys. so i have my CustomerRepo in my service and i want to handle a scenario when there are no customers with given id. so far i have this:
Optional<Customer> customer=customerRepository.findById(Long.valueOf(paymentInformationRequest.getClientId()));
        if (customer.isEmpty()) {
            log.info("BGWService.createPaymentInformation. no customer with id: {}", paymentInformationRequest.getClientId());
            throw new IllegalArgumentException("BGWService.createPaymentInformation. no customer with id:"+paymentInformationRequest.getClientId());
        }


but i was wondering if i can do smth better? thx
Was this page helpful?