我知道有类似的问题,但没有人回答我的问题。我正在使用JBoss 7.1.1和Hibernate 2.0,但<jar-file> </jar-file>
中报告的外部归档中包含的实体不会被自动检测,除非我在标签<class> </class>
之间逐个手动输入这些实体是我的毅力。 xml文件:
<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="alooh-security">
<jta-data-source>java:jboss/datasources/alooh-security</jta-data-source>
<jar-file>alooh-security-model-1.0.0-SNAPSHOT.jar</jar-file>
<properties>
<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
<property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/alooh-security"/>
<property name="hibernate.connection.username" value="root"/>
<property name="hibernate.connection.password" value="123456"/>
<!-- Properties for Hibernate (default provider for JBoss AS) -->
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.show_sql" value="true" />
<property name="hibernate.format_sql" value="false" />
<property name="hibernate.archive.autodetection" value="class, hbm" />
</properties>
</persistence-unit>
</persistence>
JPA检测到存档alooh-security-model-1.0.0-SNAPSHOT.jar中没有@Entity注释类。我不得不在标签<class> </ class>
之间逐个手动输入alooh-security-model-1.0.0-SNAPSHOT.jar中的所有实体,这真的很痛苦!
有解决方案吗?
谢谢
答案 0 :(得分:0)
好的,我在查看日志文件时看到了问题所在。我们必须使用
,而不是使用<jar-file>alooh-security-model-1.0.0-SNAPSHOT.jar</jar-file>
<jar-file>lib/alooh-security-model-1.0.0-SNAPSHOT.jar</jar-file>
问题现在解决了