yeg*_*256 3 java hibernate jpa
我persistence.xml看起来像:
<persistence>
<persistence-unit name="test">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<class>com.XXX.Abc</class>
<properties>
<property name="hibernate.archive.autodetection" value="true" />
..
</properties>
</persistence-unit>
<persistence>
Run Code Online (Sandbox Code Playgroud)
一切正常.当我删除<class>指令时,我得到一个例外EntityManager.find(Abc.class, 1):
java.lang.IllegalArgumentException: Unknown entity: com.XXX.Abc
Run Code Online (Sandbox Code Playgroud)
看起来hibernate无法发现我的注释类,虽然我正在使用@Entity..为什么?
它的值hibernate.archive.autodetection是由hibernate自动发现的csv元素列表.
试试这个:
<property name="hibernate.archive.autodetection" value="class, hbm"/>
Run Code Online (Sandbox Code Playgroud)
进一步阅读
| 归档时间: |
|
| 查看次数: |
5329 次 |
| 最近记录: |