我正在尝试使用 JPA 删除多行(如果有),但出现空指针异常。该参数和实体管理器不为空。任何想法可能导致此异常?
PS 类注解@Transactional
@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();
}
}