I\'m trying to put my named queries in my orm.xml (put in META-INF with persistence.xml) but my orm.xml seems to be ignored by hibernate/jpa.
When I try to create m
As said
When I try to create my named query with em.createNamedQuery("myQuery"), it returns that it can not find this query.
You are right. But you forget the following
If you place a named query definition inside a element, instead of the root, it is prefixed with the name of the entity class
So you need to call your namedQuery as
em.createNamedQuery("Account.myQuery")
I am curious: Does your Account class is stored in the root classpath ??? If not, you have fix its missing package. Suppose Account class is stored inside br.com.hibernate.model.domain.Account. So you should declare your entity as
And you need to call your namedQuery as
em.createNamedQuery("br.com.hibernate.model.domain.Account.myQuery") instead
Just an adivice: when you are using Hibernate as your Persistence Provider, you do not need to define your Entity class in persistence.xml file.
regards,