我在glassfish中创建了一个服务器,我希望在远程mysql数据库中有一个jpa持久层。
当我尝试使用持久层时,出现以下异常: javax.persistence.PersistenceException: No Persistence provider for EntityManager named em1
基于其他stackoverflow文章,这似乎表明persistence.xml无效。显示my persistence.xml。有人能给我指出正确的方向,让我弄明白如何让这个工作?
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence">
<persistence-unit name ="em1">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>data.entry.Movie</class>
<properties>
<property name="eclipselink.target-database"
value="MySQL4"/>
<property name="javax.persistence.jdbc.driver" value="com.mysql.jdbc.Driver" />
<property name="javax.persistence.jdbc.url" value="mysql3.cs.myschool.edu/mydb"/>
<property name="javax.persistence.jdbc.user" value="mydb" />
<property name="javax.persistence.jdbc.password" value="mypass" />
</properties>
</persistence-unit>
</persistence>
暂无答案!
目前还没有任何答案,快来回答吧!