title: check if a record exist in database using spring boot and JPA repository
body: <p>I want to check whether a record exist in database before I save. If possible I want to check using two fields i.e regno and name. method to be like checkIfRegNoAndNameExists(){}.
  my model class</p>
  
  <pre><code>@Entity
  public class Car {
       @Id
      @GeneratedValue
      private int id;
      private String regno;
      private String name;
      // getters, setters, ...
  }
  </code></pre>
  
  <p>my dao class</p>
  
  <pre><code>import org.springframework.data.jpa.repository.JpaRepository;
  public interface ProgramDao extends JpaRepository&lt;CarModel, Integer&gt; {
  }
  </code></pre>
  
  <p>my service class</p>
  
  <pre><code>@Service
  public class CarServiceImpl implements ProgramService {
      @Autowired
      private CarDao carDao;
      @Override
      public carModel saveProgram(carModel car) { 
          return carDao.save(program);
      }
  }
  </code></pre>