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;
    }

}

********************* Error on running ******************

19 Aug, 2012 8:30:22 AM org.apache.catalina.core.StandardWrapperValve invoke SEVERE: Servlet.service() for servlet [dispatcher] in context with path [/QPIAutomation] threw exception [Request processing failed; nested exception is org.hibernate.exception.SQLGrammarException: could not insert collection: [com.qpi.dao.FinalCheckListReport.carPoints#1]] with root cause java.sql.BatchUpdateException: Table 'qpi.finalchecklistreport_carpoints' doesn't exist at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:1693) at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1108) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56) at org.hibernate.persister.collection.AbstractCollectionPersister.recreate(AbstractCollectionPersister.java:1206) at org.hibernate.action.CollectionRecreateAction.execute(CollectionRecreateAction.java:58) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:188) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51)

  • Could you show the contents of your persistence.xml? Also could you check the server logs for any errors before the error you posted. The table should have been created earlier so I'm looking for an error related to the attempt to create the table. – Eelke Aug 19 '12 at 06:41

1 Answers1

0

Have you set the hbm2ddl.auto property in your Persistence.xml? This is needed to enable creation of tables etc. by Hibernate. See this question for more explanation.

Community
  • 1
  • 1
siebz0r
  • 18,867
  • 14
  • 64
  • 107