The stacktrace doesn't indicate which classes are causing the problem, but here are the classes that use the join table strategy:
Code:
package ca.triumf.mis.qms.workrequest.jpa;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorColumn;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState;
import java.util.ArrayList;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Transient;
import org.hibernate.annotations.Type;
@Entity
@Table(name = "WR_WORKFLOW")
@Inheritance(strategy = InheritanceType.JOINED)
@DiscriminatorColumn(name = "WORKFLOW_TYPE")
@NamedQueries({
@NamedQuery(name = "Workflow.findAll", query = "SELECT w FROM Workflow w"),
@NamedQuery(name = "Workflow.findById", query = "SELECT w FROM Workflow w WHERE w.id = :id")})
public abstract class Workflow implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "ID")
private Integer id;
@JoinColumn(name = "REQUESTOR", referencedColumnName = "XA_NAME_ID")
@ManyToOne
private XaName requestor;
@Column(name = "SUBMITTED_TS")
@Temporal(TemporalType.DATE)
private Date submittedTs;
@Column(name = "CREATE_TS")
@Temporal(TemporalType.DATE)
private Date createTs;
@JoinTable(name = "WR_WORKFLOW_REQUESTOR", joinColumns = {
@JoinColumn(name = "WORKFLOW", referencedColumnName = "ID", nullable = false)}, inverseJoinColumns = {
@JoinColumn(name = "REQUESTOR", referencedColumnName = "XA_NAME_ID", nullable = false)})
@ManyToMany
private List<XaName> xaNameList;//additional requestor list
@JoinTable(name = "WR_WORKFLOW_WATCHER", joinColumns = {
@JoinColumn(name = "WORKFLOW", referencedColumnName = "ID", nullable = false)}, inverseJoinColumns = {
@JoinColumn(name = "USER", referencedColumnName = "XA_NAME_ID", nullable = false)})
@ManyToMany
private List<XaName> xaNameList1;//watcher list
@OneToMany(cascade = CascadeType.ALL, mappedBy = "workflow")
private List<WorkflowHistory> workflowHistoryList;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "workflow")
private Request request;
@OneToOne(cascade = CascadeType.ALL, mappedBy = "workflow")
private ProjectCharterSheet projectCharterSheet;
@JoinColumn(name = "WORKFLOW_TYPE", referencedColumnName = "WORKFLOW_TYPE")
@ManyToOne(optional = false)
private WorkflowType workflowType;
@JoinColumn(name = "STATE", referencedColumnName = "STATE")
@Enumerated(EnumType.STRING)
@ManyToOne(optional = false)
private WorkflowState state;
@JoinColumn(name = "AUTHOR", referencedColumnName = "XA_NAME_ID")
@ManyToOne
private XaName author;
@Column(name = "PUBLIC_VISIBLE", nullable = false)
@Type(type="yes_no")
private boolean publicVisible;
@Transient
protected List<WorkflowAuthority> workflowAuthorityList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "workflow")
private List<WorkflowFacilityAuthority> workflowFacilityAuthorityList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "workflow")
private List<WorkflowServiceGroupAuthority> workflowServiceGroupAuthorityList;
[getter/setters removed]
}
Code:
package ca.triumf.mis.qms.workrequest.jpa;
import java.io.Serializable;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.PrimaryKeyJoinColumn;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.Future;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import org.hibernate.annotations.Type;
@Entity
@Table(name = "WR_REQUEST")
@DiscriminatorValue(value = "Work Request")
@PrimaryKeyJoinColumn(name = "ID")
@NamedQueries({
@NamedQuery(name = "Request.findAll", query = "SELECT r FROM Request r ORDER BY r.id"),
@NamedQuery(name = "Request.findAllWorkingRequestsByUser", query = "SELECT r FROM Request r " +
"LEFT JOIN FETCH r.projectCharterSheet " +
"WHERE r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Working " +
"AND r.requestor = :xaName " +
"ORDER BY r.createTs DESC"),
@NamedQuery(name = "Request.findAllSubmitPendingRequests", query = "SELECT r FROM Request r " +
"LEFT JOIN FETCH r.projectCharterSheet " +
"WHERE (r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Pending OR r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Approved) " +
"AND r.requestor = :xaName " +
"ORDER BY r.createTs DESC"),
@NamedQuery(name = "Request.findAllPendingRequests", query = "SELECT r FROM Request r WHERE r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Pending ORDER BY r.createTs DESC"),
@NamedQuery(name = "Request.findPendingCCSRequestsByActiveAuthority", query = "SELECT r FROM Request r " +
"JOIN r.facilityList f " +
"JOIN f.authorities a " +
"LEFT JOIN FETCH r.projectCharterSheet " +
"WHERE r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Pending " +
"AND (r.changeToCommission = true AND r.ccsApproved=false) " +
"AND :xaName MEMBER OF a.xaNameList " +
"AND f.active = true " +
"AND a.active = true " +
"ORDER BY r.createTs DESC"),
@NamedQuery(name = "Request.findPendingNonCCSRequestsByActiveAuthority", query = "SELECT r FROM Request r " +
"JOIN r.serviceGroupList g " +
"JOIN g.authorities a " +
"LEFT JOIN FETCH r.projectCharterSheet " +
"WHERE r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Pending " +
"AND ((r.changeToCommission = true AND r.ccsApproved=true) OR r.changeToCommission = false) " +
"AND :xaName MEMBER OF a.xaNameList " +
"AND g.active = true " +
"AND a.active = true " +
"ORDER BY r.createTs DESC"),
@NamedQuery(name = "Request.findById", query = "SELECT r FROM Request r WHERE r.id = :id"),
@NamedQuery(name = "Request.findByTitle", query = "SELECT r FROM Request r WHERE r.title LIKE :title AND (r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Pending " +
"OR r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Approved " +
"OR r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Closed " +
"OR r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Abandoned " +
"OR (r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Working AND r.publicVisible = true))"),
@NamedQuery(name = "Request.findByCommitmentTrackingNumber", query = "SELECT r FROM Request r WHERE r.commitmentTrackingNumber LIKE :commitmentTrackingNumber "),
@NamedQuery(name = "Request.findByRequestorAndPublicVisible", query = "SELECT r FROM Request r WHERE r.state = ca.triumf.mis.qms.workrequest.jpa.enums.WorkflowState.Working AND r.requestor =:xaName AND r.publicVisible = true"),
@NamedQuery(name = "Request.findByWorkRequestNumber", query = "SELECT r FROM Request r WHERE r.workRequestNumber = :workRequestNumber"),
@NamedQuery(name = "Request.findByProjectAccount", query = "SELECT r FROM Request r WHERE r.projectAccount = :projectAccount"),
@NamedQuery(name = "Request.findByProjectSubAccount", query = "SELECT r FROM Request r WHERE r.projectSubAccount LIKE :projectSubAccount"),
@NamedQuery(name = "Request.findByDateRequired", query = "SELECT r FROM Request r WHERE r.dateRequired = :dateRequired"),
@NamedQuery(name = "Request.findBySummary", query = "SELECT r FROM Request r WHERE r.summary = :summary"),
@NamedQuery(name = "Request.findByChangeToCommission", query = "SELECT r FROM Request r WHERE r.changeToCommission = :changeToCommission")})
public class Request extends Workflow implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@Basic(optional = false)
@Column(name = "ID", nullable = false)
private Integer id;
@Column(name = "TITLE", length = 500)
@Size(max=500, message ="Title can not exceed 500 letters")
private String title;
@Column(name = "COMMITMENT_TRACKING_NUMBER")
@Size(max=128, message ="Commitment Tracking Number can not exceed 128 letters/digits")
private String commitmentTrackingNumber;
@Column(name = "WORK_REQUEST_NUMBER")
private Integer workRequestNumber;
@Column(name = "PROJECT_SUB_ACCOUNT")
@Size(max=128, message ="Project sub account can not exceed 128 letters/digits")
private String projectSubAccount;
@Column(name = "DATE_REQUIRED")
@Temporal(TemporalType.DATE)
private Date dateRequired;
@Column(name = "SUMMARY", length = 500)
@Size(max=500, message ="Summary can not exceed 500 letters")
private String summary;
@Column(name = "CHANGE_TO_COMMISSION")
@Type(type="yes_no")
private boolean changeToCommission;
@Column(name = "CCS_APPROVED")
@Type(type="yes_no")
private boolean ccsApproved;
@Column(name = "PROJECT_ACCOUNT")
private Integer projectAccount;
@JoinTable(name = "WR_REQUEST_ENGINEERING_GROUP", joinColumns = {
@JoinColumn(name = "REQUEST", referencedColumnName = "ID", nullable = false)}, inverseJoinColumns = {
@JoinColumn(name = "ENGINEERING_GROUP", referencedColumnName = "ID", nullable = false)})
@ManyToMany
private List<ServiceGroup> serviceGroupList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "request", orphanRemoval = true)
private List<Document> documentList;
@JoinTable(name = "WR_REQUEST_FACILITY", joinColumns = {
@JoinColumn(name = "ID", referencedColumnName = "ID", nullable = false)}, inverseJoinColumns = {
@JoinColumn(name = "FACILITY", referencedColumnName = "ID", nullable = false)})
@ManyToMany
private List<Facility> facilityList;
@JoinColumn(name = "ID", referencedColumnName = "ID", nullable = false, insertable = false, updatable = false)
@OneToOne(optional = false)
private Workflow workflow;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "request", orphanRemoval = true)
private List<Deliverable> deliverableList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "request", orphanRemoval = true)
private List<Hazard> hazardList;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "request1")
private List<QuestionRequestAnswer> questionRequestAnswerList;
[getter/setters removed]
There are two other object hierarchies, but they are set up pretty similarly as this one.