我创建了一个带有POJO类“Employee”的EJB程序,但是在将EJB部署到JBOSS 7.1 AS服务器上时,它没有创建Schema(Schema not Exported)而没有任何错误。
任何一个建议,该计划有什么问题。
服务器日志。
18:43:34,445 INFO [org.jboss.as.server](控制器启动线程) JBAS018559:已部署“ojdbc6.jar”18:43:34,456信息 [org.jboss.as.server.deployment](MSC服务主题1-8)JBAS015876: 开始部署“FirstEJBProject.jar”18:43:34,587 INFO [org.jboss.as.jpa](MSC服务主题1-8)JBAS011401:读取 firstEJBProject 18:43:34,632 INFO的persistence.xml [org.jboss.as.jpa](MSC服务主题1-5)JBAS011402:正在启动 持久性单位服务'FirstEJBProject.jar #FirstEJBProject' 18:43:36,284 INFO [org.hibernate.annotations.common.Version](MSC 服务主题1-5)HCANN000001:Hibernate Commons Annotations {4.0.1.Final} 18:43:36,375 INFO [org.hibernate.Version](MSC服务 线程1-5)HHH000412:Hibernate Core {4.0.1.Final} 18:43:36,385 INFO [org.hibernate.cfg.Environment](MSC服务主题1-5)HHH000206: hibernate.properties not found 18:43:36,393 INFO [org.hibernate.cfg.Environment](MSC服务主题1-5)HHH000021: 字节码提供者名称:javassist 18:43:36,556 INFO [org.hibernate.ejb.Ejb3Configuration](MSC服务主题1-5) HHH000204:处理PersistenceUnitInfo [name:FirstEJBProject ......] 18:43:36,993信息 [org.hibernate.service.jdbc.connections.internal.ConnectionProviderInitiator] (MSC服务线程1-5)HHH000130:实例化显式连接 供应商: org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider 18:43:37,939 INFO [org.hibernate.dialect.Dialect](MSC服务主题 1-5)HHH000400:使用方言:org.hibernate.dialect.Oracle10gDialect 18:43:38,003 INFO [org.hibernate.engine.transaction.internal.TransactionFactoryInitiator] (MSC服务主题1-5)HHH000268:交易策略: org.hibernate.engine.transaction.internal.jta.CMTTransactionFactory 18:43:38,013 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory](MSC 服务线程1-5)HHH000397:使用ASTQueryTranslatorFactory 18:43:38,306 INFO [org.hibernate.validator.util.Version](MSC服务 线程1-5)Hibernate Validator 4.2.0.Final 18:43:39,301 INFO [org.jboss.as](MSC服务主题1-5)JBAS015951:管理控制台 听取http://:9990 18:43:39,304 INFO [org.jboss.as] (MSC服务主题1-5)JBAS015874:JBoss AS 7.1.1.Final“Brontes” 开始于9361ms - 启动了260项服务中的180项(78项服务是 被动或按需)18:43:39,406 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2)JBAS018559:已部署 “FirstEJBProject.jar”
的persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="FirstEJBProject">
<jta-data-source>java:/XE</jta-data-source>
<class>Persistance.Employee</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
<property name="hibernate.hbm2dll.auto" value="create"/>
</properties>
</persistence-unit>
</persistence>
员工POJO课程:
package Persistance;
import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
@Entity
public class Employee implements Serializable {
public Employee() {
}
private int idEmployee;
private String nameEmployee;
private String lastNameEmployee;
private Date dateNaissance;
private String function;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
public int getIdEmployee() {
return idEmployee;
}
public void setIdEmployee(int idEmployee) {
this.idEmployee = idEmployee;
}
public String getNameEmployee() {
return nameEmployee;
}
public void setNameEmployee(String nameEmployee) {
this.nameEmployee = nameEmployee;
}
public String getLastNameEmployee() {
return lastNameEmployee;
}
public void setLastNameEmployee(String lastNameEmployee) {
this.lastNameEmployee = lastNameEmployee;
}
@Temporal(TemporalType.DATE)
public Date getDateNaissance() {
return dateNaissance;
}
public void setDateNaissance(Date dateNaissance) {
this.dateNaissance = dateNaissance;
}
public String getFunction() {
return function;
}
public void setFunction(String function) {
this.function = function;
}
public Employee(String nameEmployee, String lastNameEmployee,
Date dateNaissance, String function) {
super();
this.nameEmployee = nameEmployee;
this.lastNameEmployee = lastNameEmployee;
this.dateNaissance = dateNaissance;
this.function = function;
}
}
答案 0 :(得分:0)
我发现您的部署可能存在两个问题:
persistence.xml
文件使用JPA 2.1描述符。 JBoss AS 7.1.1支持2.0及更低版本。如果你想要2.1,你应该使用WildFly。IDENTITY
策略将自动生成的ID与持久性单元的Oracle10g方言结合使用。 Oracle 10g不支持SQL IDENTITY
的概念,因此您应该选择其他策略,如SEQUENCE
或TABLE
。