Hi,
I'm using Glassfish and Hibernate to development some enterprise applications but I have a problem with @NamedQueries...I always get the following exception:
Code:
javax.persistence.PersistenceException: org.hibernate.MappingException: Named query not known: findAll
Here's a small example:
The entity beanCode:
@Entity
@Table(name="Customer")
@NamedQueries({
@NamedQuery(name = "findAll", query = "SELECT c FROM Customer c")
})
public Customer implements Serializable {
...
}
The business interfaceCode:
@Remote
public interface CustomerManager {
public Customer[] getAll();
}
And the stateless session beanCode:
@Stateless
public CustomerManagerBean implements CustomerManager {
@PersistenceContext(unitName="testPU")
private EntityManager em;
public Customer[] getAll() {
// The following line throws the mapping exception - org.hibernate.MappingException: Named query not known: findAll
Query q = em.createNamedQuery("findAll");
...
}
}
Any clue how to solve this problem?
Thanx