NamedQuery: IllegalArgumentException (Query not found) after externalizing entities

风格不统一 提交于 2019-12-03 11:16:53

The solution is to specify the classes containing JPA Entities in the persistence.xml file:

<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
    <persistence-unit name="bonusAppServerPU" transaction-type="JTA">
        <provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
        <jta-data-source>jdbc/someDB</jta-data-source>
        <class>com.skalio.bonusapp.core.Store</class>
    </persistence-unit>
</persistence>

Background is that JPA needs to be told where to scan for annotations. The other option is to use the <jar-file></jar-file> node.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!