我想在JBoss AS中7.1.1JBoss作爲7 Hibernate配置
配置Hibernate。我只會把WEB-INF文件夾
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="actionBazaar" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ActionBazaarDS</jta-data-source>
<properties>
<property name="hibernate.show_sql" value="true" />
</properties>
</persistence-unit>
</persistence>
OB中的persistence.xml:JBOSS 7.1.1有一個休眠4模塊和我有一個數據源命名的java:/ ActionBazaarDS
,但我得到這個錯誤:
Can't find a persistence unit named actionBazaar in deployment "ActionBazaar.war"
當我嘗試使用:
web.xml上@PersistenceContext(unitName="actionBazaar")
private EntityManager entityManager;
你試過WEB-INF /班/ META-INF/persistence.xml中? – jjhavokk
我也試過,但沒有成功 –
請按照此鏈接 [鏈接] http://stackoverflow.com/questions/14060051/how-to-configure-hibernate-in-j-boss/21159460#21159460 –