jpa - EntityManager.createNamedQuery(...) doesn't work -
i have defined namednativequery next lot of namedqueries . namedqueries entitymanager.createnamedquery(queryname) works when using namednativequery exception: java.lang.illegalargumentexception: namedquery of name: mynamednativequeryname not found. the query works executed in mysql workbench defining namednativequery: @namednativequeries(value = { @namednativequery(name = findvehicletracksbyuuidandtimerange, query="...", resultclass=mytype.class) }) the exception occurs. try run query way: try { list<e> resultlist = new arraylist<e>(); javax.persistence.query query = getentitymanager().createnamedquery(queryname, type); } catch(...) what can reason? stated: code above runs dozens of namedqueries...but not namednativequery.