How to throw exceptions on search methods in spring data jpa
<p>I am using spring-data-jpa repositories for database operations. I want to throw exceptions if object doesn't exists in database for all methods in my repositories. For example Consider the following method in <code>OrderRepository</code></p>

<pre><code>findByCustomerAndPayment(Customer customer, Payment payment);
</code></pre>

<p>I want to query all orders based on customerId and paymentId. Both the objects are neccessry in the above query. But spring-data-rest returns null if I gave cutomerId doesn't exists in database. I expect spring-data-rest to throw exception if object doesn't exists in database.</p>

<p>How to achieve this?</p>