Hello everyone, i seem to be having a very weird problem with
all the named queries inside my classes: I'm getting the error:
Code:
javax.ejb.EJBException: java.lang.IllegalArgumentException: Named query not found: World.getPopulation
On init, JBoss (i'm using 5.1.0.GA) says that it found both the class and the named query:
Code:
16:46:25,763 INFO [QueryBinder] Binding Named query: World.getPopulation => SELECT COUNT(w) FROM World w WHERE w.state = :state
This is how i'm defining my "World" class:
Code:
@Entity
@Table (name="world")
@NamedQueries (value = {
@NamedQuery (
name=World.GET_POPULATION,
query="SELECT COUNT(w) FROM World w WHERE w.state = :state"
)
})
public class World
extends IdentifiableEntity
{
public final static String GET_POPULATION = "World.getPopulation";
...
}
In order to call it from inside my bean i'm doing:
Code:
final EntityManager em = getEntityManager ();
final Query query;
query = em.createNamedQuery (World.GET_POPULATION);
query.setParameter ("state", World.ACTIVE);
return (Long) query.getSingleResult ();
Does anyone have any idea of what might be going on?
Thanks in advance.