Jpa java.lang.IllegalArgumentException:没有为该名称定义查询[Offices.getAllOffices]

Jpa java.lang.IllegalArgumentException:没有为该名称定义查询[Offices.getAllOffices],jpa,illegalargumentexception,named-query,Jpa,Illegalargumentexception,Named Query,我开始学习JavaEE和Wildfly(JBoss服务器应用程序)。我的项目已经可以运行了,但是,当我尝试启动.xhtml页面时,我从服务器应用程序收到一个错误 Caused by: java.lang.IllegalArgumentException: No query defined for that name [Offices.getAllOffices] at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx

我开始学习JavaEE和Wildfly(JBoss服务器应用程序)。我的项目已经可以运行了,但是,当我尝试启动.xhtml页面时,我从服务器应用程序收到一个错误

Caused by: java.lang.IllegalArgumentException: No query defined for that name [Offices.getAllOffices]
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleExceptionInOurTx(CMTTxInterceptor.java:187)
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInOurTx(CMTTxInterceptor.java:277)
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:327)
    at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:239)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:340)
    at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41)

这个错误很直接。我将把清晰的部分单独复制出来以反映它

No query defined for that name [Offices.getAllOffices]
您可能在代码中使用了一个命名查询,并引用了这个名称。此命名查询不存在