我有以下代码导致java.lang.NullPointerException
:
List results = em.createNamedQuery("User.findByUserName").setParameter("userName", username).getResultList();
User 是实体 bean,它包含:
@NamedQuery(name = "User.findByUserName", query = "SELECT u FROM User u WHERE u.userName = :userName"),
有谁知道为什么?