say you have defined the `Named Query` as `application.myquery` in XML file.
服务/道层
List results = em.createNamedQuery("application.myquery") .setParameter("username", "blah") .setParameter("password","blahblahblah") .getResultList();该
orm文件需要包含在其中,
persistence.xml并且应该位于
meta-INF/persistence.xml。
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0"> <persistence-unit name="myUnit" transaction-type="RESOURCE_LOCAL"> <mapping-file>meta-INF/orm.xml</mapping-file> <exclude-unlisted-classes/> </persistence-unit></persistence>
请参阅此以获取更多信息。



