I have a data access class that exposes basic operations for an entity class used on a web site:
public class UserDataAccessService {
public User login(User u)...
public User findByUsername(String username)...
I want to define all HQL/SQL queries in this data access class, but I'm having trouble using the hibernate @NamedQuery annotation; Hibernate keeps saying that it can't find the named query. I don't intend to define lookup/find methods in the entity classes because I don't feel it's the appropriate location for it.
I am using annotations and hibernate.cfg.xml only, so where can I declare these queries so that Hibernate can find them?