Oh yes sorry, I forgot.
I tried two way:
1) NamedQueries:
Here the definition:
@NamedNativeQueries( value = {
@NamedNativeQuery(
name = "byName",
query = "SELECT u FROM Users u WHERE u.username = ?1"
)
})
In in the Code:
Query q = em.createNamedQuery("byName");
q.setParameter("username", name);
List o = q.getResultList();
2) Direct:
Query q = em.createQuery("select u from Users u where u.username = :username");
q.setParameter("username", name);
List o = q.getResultList();
Thanks
[Message sent by forum member 'flyingfinger' (flyingfinger)]
http://forums.java.net/jive/thread.jspa?messageID=341044