title: JPA, Can not delete record
body: <p>I'm trying to delete multiple rows(if any) using JPA, and I get <strong>nullpointer</strong> exception. The  parameter and the entity manager is <strong>not</strong> null. Any ideas what might be causing this exception?</p>
  
  <p>P.S The class is annotated @Transactional</p>
  
  <pre><code>@Override
  public void removeAccount(String id) {
      try {
  
          int deleteRecords = entityManager.createQuery("DELETE from bankaccount b where b.accountNumber = ?1", BankAccount.class)
                  .setParameter(1, accountNumber)
                  .executeUpdate();
  
      } catch (Exception ex) {
          ex.getMessage();
      }
  }
  </code></pre>