我正在使用 intellij Idea 使用 JPA 和 Jboss 8.2 创建 EJB:当我解压缩 jar 文件时,我正在构建一个 jar 文件作为输出我找不到异常单位名称。有没有解决方案和thanx很多。
这个persistance.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
<persistence-unit name="EJBUser" transaction-type="JTA">
<jta-data-source>java:/EJBUser</jta-data-source>
<class>entities.User</class>
<properties>
<property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/>
</properties>
</persistence-unit>
</persistence>
这是我的豆子
package ejb;
import bl.UserLocal;
import entities.User;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* Created by mehdi on 04/02/2019.
*/
@Stateless(name = "UserImpLocalEJB")
public class UserImpLocalBean implements UserLocal{
@PersistenceContext(unitName = "EJBUser")
private EntityManager em;
public UserImpLocalBean() {
}
@Override
public User addUser(User user) {
em.persist(user);
return user;
}
}
HUWWW
慕码人2483693
相关分类