为什么我的JPA注释类没有隐式发现? [英] why my JPA annotated classes are not discovered implicitly?
问题描述
我的 persistence.xml
看起来像:
<持续性>> ;
< persistence-unit name =test>
< provider> org.hibernate.ejb.HibernatePersistence< / provider>
< class> com.XXX.Abc< / class>
<属性>
< property name =hibernate.archive.autodetectionvalue =true/>
..
< / properties>
< / persistence-unit>
<持久性>
一切正常。当我删除 虽然我使用 试试这个: 进一步阅读 My Everything works fine. When I'm removing Looks like hibernate can't discover my annotated classes although I'm using The value of the Try this instead:
Further Reading 这篇关于为什么我的JPA注释类没有隐式发现?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!< class>
指令时,我收到了一个来自 EntityManager.find(Abc.class,1)$ c
$ p $ java.lang.IllegalArgumentException:未知实体:com.XXX.Abc
@Entity
..为什么?
< property name =hibernate.archive.autodetectionvalue =class,hbm/>
persistence.xml
looks like:<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>
<class>
directive I'm getting an exception from EntityManager.find(Abc.class, 1)
:java.lang.IllegalArgumentException: Unknown entity: com.XXX.Abc
@Entity
.. Why?hibernate.archive.autodetection
is a csv list of elements that are autodiscovered by hibernate.<property name="hibernate.archive.autodetection" value="class, hbm"/>