Why wouldn't you put it on the clas/entity you are querying for?
[code]
@NamedQuery
(
name = "getData",
query = "SELECT gu" +
" FROM MyEntityBean AS geb, IN ( geb.myUpdates ) gu " +
" WHERE geb = :x"
)
@Entity
public class MyEntity {
[/code]
Named queries are not meant to be dynamic - they are defined and loaded with the persistence unit so that they can be reused by applications, much like the entities are themselves. The provider only looks through entity classes and classes defined in the persistence.xml, that is why the namedquery annotation will be ignored anywhere else.
Hope this helps,
Chris
[Message sent by forum member 'chris_delahunt' (chris_delahunt)]
http://forums.java.net/jive/thread.jspa?messageID=223773