title: Spring JDBC template throws an Incorrect result size exception
body: <p>I am getting an <code>exception</code> when I run the <code>jdbctemplate</code> to get the id from my table. The exception is:</p>
  
  <pre><code>org.springframework.dao.EmptyResultDataAccessException: Incorrect result size: expected 1, actual 0
  </code></pre>
  
  <p>I have the script as below:</p>
  
  <pre><code>CREATE TABLE LOGIN(
  PERSON_ID SERIAL PRIMARY KEY, 
  USERNAME VARCHAR(20) CHECK (USERNAME IS NOT NULL),
  PASSWORD VARCHAR(20) CHECK (PASSWORD IS NOT NULL)
  );
  </code></pre>
  
  <p>and the <code>jdbctemplate code</code> is:</p>
  
  <pre><code>@Override
  public int getPersonId(UsernamePassword usernamePassword) {
      return jdbcTemplate.queryForObject("SELECT PERSON_ID FROM LOGIN WHERE USERNAME = ? AND PASSWORD = ?", Integer.class,
              usernamePassword.getUser_name(), usernamePassword.getPassword());
  
  }
  </code></pre>
  
  <p>I also tried other methods that <code>jdbctemplate</code> provides, but I had no luck. I will appreciate any help. Thanks.</p>