1
package com.qpi.dao;


import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Id;
/*import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
*/import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name="QPI_Report")
public class FinalCheckListReport {

    @Id 
    private Integer projectId;

    @Temporal(TemporalType.DATE)
    private Date date ;

    @ElementCollection
    private Collection<PMGenericPoints> genericcheckpoints = new ArrayList<PMGenericPoints>();

    @ElementCollection
    private Collection<ClosurePoints> closurepoints = new ArrayList<ClosurePoints>();

    @ElementCollection
    private Collection<DevPoints> devPoints = new ArrayList<DevPoints>();

    @ElementCollection
    private Collection<CarPoints> carPoints = new ArrayList<CarPoints>();

    @ElementCollection
    private Collection<TriggerBasedPoints> triggerpoints = new ArrayList<TriggerBasedPoints>();

    @ElementCollection
    private Collection<MetricsPoints> metricspoints = new ArrayList<MetricsPoints>();

    @ElementCollection
    private Collection<CMPoints> cmPoints = new ArrayList<CMPoints>();

    @ElementCollection
    private Collection<MaintenancePoints> maintenancePoints = new ArrayList<MaintenancePoints>();

    @ElementCollection
    private Collection<IsmsPoints> ismspoints = new ArrayList<IsmsPoints>();

    @ElementCollection
    private Collection<KtAndInitiationPoints> kt = new ArrayList<KtAndInitiationPoints>();

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getProjectId() {
        return projectId;
    }

    public void setProjectId(Integer projectId) {
        this.projectId = projectId;
    }

    public Collection<PMGenericPoints> getGenericcheckpoints() {
        return genericcheckpoints;
    }

    public void setGenericcheckpoints(
            Collection<PMGenericPoints> genericcheckpoints) {
        this.genericcheckpoints = genericcheckpoints;
    }

    public Collection<ClosurePoints> getClosurepoints() {
        return closurepoints;
    }

    public void setClosurepoints(Collection<ClosurePoints> closurepoints) {
        this.closurepoints = closurepoints;
    }

    public Collection<DevPoints> getDevPoints() {
        return devPoints;
    }

    public void setDevPoints(Collection<DevPoints> devPoints) {
        this.devPoints = devPoints;
    }

    public Collection<CarPoints> getCarPoints() {
        return carPoints;
    }

    public void setCarPoints(Collection<CarPoints> carPoints) {
        this.carPoints = carPoints;
    }

    public Collection<TriggerBasedPoints> getTriggerpoints() {
        return triggerpoints;
    }

    public void setTriggerpoints(Collection<TriggerBasedPoints> triggerpoints) {
        this.triggerpoints = triggerpoints;
    }

    public Collection<MetricsPoints> getMetricspoints() {
        return metricspoints;
    }

    public void setMetricspoints(Collection<MetricsPoints> metricspoints) {
        this.metricspoints = metricspoints;
    }

    public Collection<CMPoints> getCmPoints() {
        return cmPoints;
    }

    public void setCmPoints(Collection<CMPoints> cmPoints) {
        this.cmPoints = cmPoints;
    }

    public Collection<MaintenancePoints> getMaintenancePoints() {
        return maintenancePoints;
    }

    public void setMaintenancePoints(Collection<MaintenancePoints> maintenancePoints) {
        this.maintenancePoints = maintenancePoints;
    }

    public Collection<IsmsPoints> getIsmspoints() {
        return ismspoints;
    }

    public void setIsmspoints(Collection<IsmsPoints> ismspoints) {
        this.ismspoints = ismspoints;
    }

    public Collection<KtAndInitiationPoints> getKt() {
        return kt;
    }

    public void setKt(Collection<KtAndInitiationPoints> kt) {
        this.kt = kt;
    }

}

** * ** * ** * ** * ** * ** * ***运行时出错** * ** * ** * ** * ** * ***

2012 年 8 月 19 日上午 8:30:22 org.apache.catalina.core.StandardWrapperValve 调用严重:Servlet.service() 用于路径 [/QPIAutomation] 上下文中的 servlet [dispatcher] 引发异常 [请求处理失败;嵌套异常是 org.hibernate.exception.SQLGrammarException:无法插入集合:[com.qpi.dao.FinalCheckListReport.carPoints#1]],根本原因是 java.sql.BatchUpdateException:表 'qpi.finalchecklistreport_carpoints' 不存在于com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1693) 在 com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1108) 在 org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70)在 org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56) 在 org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1206) 在 org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java :58) 在 org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) 在 org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) 在 org.hibernate.engine.ActionQueue.executeActions(ActionQueue. java:188) 在 org.hibernate.event.def.AbstractFlushingEventListener。在 org.hibernate.event.def.DefaultFlushEventListener.onFlush 执行执行(AbstractFlushingEventListener.java:321)(DefaultFlushEventListener.java:51)

4

1 回答 1

0

您是否hbm2ddl.auto在 Persistence.xml 中设置了该属性?这是启用 Hibernate 创建表等所必需的。有关更多解释,请参阅此问题

于 2012-08-20T07:54:28.460 回答