title: JDBCTemplate find if row exists
body: <p>I am curious as to how I should use springs jdbctemplate class to determine if a record or row exists already in one of my tables?? I have tried</p>
  
  <pre><code>int count = jdbcTemplate.queryForObject("select * from MyTable
                                    where Param = ?", new Object[] {myParam},
                                    Integer.class);
  if(count ==0)
      //record does not exist
  </code></pre>
  
  <p>The issue is though I keep getting either <code>EmptyResultAccessDataException</code>'s, when it doesn't exist so I updated the code to </p>
  
  <pre><code>try{
      jdbcTemplate.queryForObject("select * from MyTable
                                    where Param = ?", new Object[] {myParam},
                                    Integer.class);
  } catch(EmptyResultAccessDataException e) {//insert the record}
  </code></pre>
  
  <p>which then gives me issues if the record does exist. So I guess my real question is what is the best method to search for a records existence in a table as I want to add said record if it doesn't and do nothing if it does.</p>