0

I have project which is currently failing to deploy successfully. During deployment I get the following exception

Caused by: javax.persistence.PersistenceException: org.hibernate.MappingException: Repeated column in mapping for entity: com.bedbath.amsSched.model.AgreementVendor column: AGRMTID (should be mapped with insert="false" update="false")

I don't however see any duplicate coloumn. I have read some other posts and have tried adding insertable=false, updatable=false on the AGRMTID coloum as suggested, but it did not work.

Here is the entity class

package com.bedbath.amsSched.model;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * AgreementVendor entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "AMPGVNDR", schema = "WEBQA")
public class AgreementVendor implements java.io.Serializable
{
private static final long serialVersionUID = -7147948264083644942L;
private Integer agreementVendorId;
private Agreement agreement;
private AgreementVendorTypeCode agreementVendorTypeCode;
private String vendorJdaId;
private String vendorName;
private String vendorType;
private String agreementVendorBuyerId;
private String agreementVendorBuyerName;
private AgreementConcept agreementConcept;
private String termsDescription;
private String newStoreTermsDays;
private String newStoreTermsPercent;
private boolean primaryVendor;
private Set<AgreementVendorNetSalesContact> agreementVendorNSCs = new HashSet<AgreementVendorNetSalesContact>(0);

// Constructors

/** default constructor */
public AgreementVendor()
{
}

/** minimal constructor */
public AgreementVendor(Integer agvndrid)
{
    this.agreementVendorId = agvndrid;
}


/** full constructor */
public AgreementVendor(Integer agvndrid, Agreement agreement, AgreementVendorTypeCode agreementVendorTypeCode, String jdaid)
{
    this.agreementVendorId = agvndrid;
    this.agreement = agreement;
    this.agreementVendorTypeCode = agreementVendorTypeCode;
    this.vendorJdaId = jdaid;
}

// Property accessors
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "AGVNDRID", unique = true, nullable = false, precision = 5, scale = 0)
public Integer getAgreementVendorId()
{
    return agreementVendorId;
}

public void setAgreementVendorId(Integer agreementVendorId)
{
    this.agreementVendorId = agreementVendorId;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AGRMTID")
public Agreement getAgreement()
{
    return this.agreement;
}

public void setAgreement(Agreement agreement)
{
    this.agreement = agreement;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "VNDTYCID")
public AgreementVendorTypeCode getAgreementVendorTypeCode()
{
    return this.agreementVendorTypeCode;
}

public void setAgreementVendorTypeCode(AgreementVendorTypeCode agreementVendorTypeCode)
{
    this.agreementVendorTypeCode = agreementVendorTypeCode;
}

@Column(name = "JDAID", length = 50)
public String getVendorJdaId()
{
    return vendorJdaId;
}

public void setVendorJdaId(String vendorJdaId)
{
    this.vendorJdaId = vendorJdaId;
}

@Column(name = "AGRMTVNM", length = 50)
public String getVendorName()
{
    return vendorName;
}

public void setVendorName(String vendorName)
{
    this.vendorName = vendorName;
}

@Column(name = "VNDTYP", length = 1)
public String getVendorType()
{
    return vendorType;
}

public void setVendorType(String vendorType)
{
    this.vendorType = vendorType;
}

@Column(name = "VNDBYRNUM", length = 3)
public String getAgreementVendorBuyerId()
{
    return agreementVendorBuyerId;
}

public void setAgreementVendorBuyerId(String agreementVendorBuyerId)
{
    this.agreementVendorBuyerId = agreementVendorBuyerId;
}

@Column(name = "VNDBYRNM", length = 20)
public String getAgreementVendorBuyerName()
{
    return agreementVendorBuyerName;
}

public void setAgreementVendorBuyerName(String agreementVendorBuyerName)
{
    this.agreementVendorBuyerName = agreementVendorBuyerName;
}

@Column(name = "VNDPRIM")
public boolean isPrimaryVendor()
{
    return primaryVendor;
}

public void setPrimaryVendor(boolean primaryVendor)
{
    this.primaryVendor = primaryVendor;
}

@Transient
public String getTermsDescription()
{
    return termsDescription;
}

public void setTermsDescription(String termsDescription)
{
    this.termsDescription = termsDescription;
}

@Transient
public String getNewStoreTermsDays()
{
    return newStoreTermsDays;
}

public void setNewStoreTermsDays(String newStoreTermsDays)
{
    this.newStoreTermsDays = newStoreTermsDays;
}

@Transient
public String getNewStoreTermsPercent()
{
    return newStoreTermsPercent;
}

public void setNewStoreTermsPercent(String newStoreTermsPercent)
{
    this.newStoreTermsPercent = newStoreTermsPercent;
}

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "AGCONID")
public AgreementConcept getAgreementConcept()
{
    return agreementConcept;
}

public void setAgreementConcept(AgreementConcept agreementConcept)
{
    this.agreementConcept = agreementConcept;
}

@Override
public int hashCode()
{
    final int prime = 31;
    int result = 1;
    result = prime * result + ((vendorJdaId == null) ? 0 : vendorJdaId.hashCode());
    result = prime * result + ((vendorName == null) ? 0 : vendorName.hashCode());
    return result;
}

@Override
public boolean equals(Object obj)
{
    if (this == obj)
        return true;
    if (obj == null)
        return false;
    if (getClass() != obj.getClass())
        return false;
    AgreementVendor other = (AgreementVendor) obj;
    if (vendorJdaId == null)
    {
        if (other.vendorJdaId != null)
            return false;
    }
    else if (!vendorJdaId.equals(other.vendorJdaId))
        return false;
    if (vendorName == null)
    {
        if (other.vendorName != null)
            return false;
    }
    else if (!vendorName.equals(other.vendorName))
        return false;
    return true;
}

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "agreementVendor")
public Set<AgreementVendorNetSalesContact> getAgreementVendorNSCs()
{
    return agreementVendorNSCs;
}

public void setAgreementVendorNSCs(Set<AgreementVendorNetSalesContact> agreementVendorNSCs)
{
    this.agreementVendorNSCs = agreementVendorNSCs;
}

@Override
public String toString()
{
    return vendorName;
}
}

Any thoughts would be appreciated. Thanks -Jim

4

0 回答 0