title: Run HQL query based on 3 search criteria
body: <p>I have a jsp page having 3 input fields name, Title and office location . When  a user enter values in these fields I fire a query in my controller based on the values and display the matching results. The problem arises when the user keeps any field empty. for example if title is left empty then it gives null pointer exception. Can someone tell me the query to search users based on these three criteria. Here is my query and code:</p>
  
  <pre><code>  @Query("select user from User user LEFT JOIN user.titleId title LEFT JOIN 
    user.officeLocationId officeLocation WHERE user.fullName = :fullName OR title.titleName = 
    :titleName OR officeLocation.addressLine1 = :addressLine1")
      List&lt;User&gt; getAllUserBasedOnCriteria(@Param("fullName") String fullName, 
   @Param("titleName") String titleName, @Param("addressLine1") String addressLine1);
  </code></pre>