title: Java boolean function that returns if data exists in database
body: <p>This is the function that I have currently. However, it is not returning anything.</p>
  
  <pre><code>public boolean authenticateDisabledRegions(int analystId, List&lt;Integer&gt; regionIds) {
      Integer query = jdbcTemplate.queryForObject(
          "select count(*) from ANALYST_REGION_MAPPING WHERE STATUS = 0 AND ANALYST_ID = ? AND REGION_ID = ?", 
          Integer.class, analystId, regionIds);
  
      return query != null &amp;&amp; query &gt; 0;
  }
  </code></pre>
  
  <p>I tried to do this but it does not seem to be working,
  I have been looking it up and there are a lot of suggestions that say fo the ResultSet rs with rs.next()
  I am just wondering what the best approach is for this type of function.</p>
  
  <p>The purpose of this is to check whether it exists, if it does, it will call update (&amp;change status), if not, it will call insert.</p>