2012-03-04 36 views
2

我试图从Play 2.0 Scala应用程序中使用JPA。在我的代码有:无法从有效的persistence.xml创建EntityManager

val factory = Persistence.createEntityManagerFactory("devcrowd") 

我也有persistence.xml在包META-INF

<?xml version="1.0" encoding="UTF-8"?> 
<persistence 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" version="2.0"> 
<persistence-unit name="devcrowd" transaction-type="RESOURCE_LOCAL"> 
    <provider>org.hibernate.ejb.HibernatePersistence</provider> 
    <properties> 
     <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect"/> 
     <property name="hibernate.connection.driver_class" value="org.postgresql.Driver"/> 
     <property name="hibernate.connection.username" value="xxxx"/> 
     <property name="hibernate.connection.password" value="xxxx"/> 
     <property name="hibernate.connection.url" value="jdbc:postgresql://localhost:5432/devcrowd"/> 
    </properties> 
</persistence-unit> 
</persistence> 

这似乎的persistence.xml有效的给我,但工厂不能创建:

PersistenceException: No Persistence provider for EntityManager named devcrowd 
+0

减少堆栈跟踪。检查postgresql jdbc是否在classpath中。 – 2012-03-05 07:31:53

+0

冬眠,就此而言。 – 2012-04-16 14:13:10

回答

1

您在部署时缺少Hibernate库。

相关问题