diff --git a/greeter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java b/greeter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java index bea65502bd..c099adcf03 100644 --- a/greeter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java +++ b/greeter/src/main/java/org/jboss/as/quickstarts/greeter/domain/EJBUserDao.java @@ -30,16 +30,18 @@ public class EJBUserDao implements UserDao { @Inject private EntityManager entityManager; + @Override public User getForUsername(String username) { try { - Query query = entityManager.createQuery("select u from User u where u.username = ?"); - query.setParameter(1, username); + Query query = entityManager.createQuery("select u from User u where u.username = :username"); + query.setParameter("username", username); return (User) query.getSingleResult(); } catch (NoResultException e) { return null; } } + @Override public void createUser(User user) { entityManager.persist(user); }