Hibernate在实体的映射中给出重复列....但它看起来不像有重复

时间:2012-08-09 19:40:42

标签: hibernate jpa

我的项目目前无法成功部署。在部署期间,我得到以下异常

引起:javax.persistence.PersistenceException:org.hibernate.MappingException:实体映射中的重复列:com.bedbath.amsSched.model.AgreementVendor列:AGRMTID(应使用insert =“false”update =“映射”假“)

然而,我没有看到任何重复的coloumn。我已阅读其他一些帖子并尝试按照建议在AGRMTID coloum上添加insertable = false,updatable = false,但它不起作用。

这是实体类

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

任何想法都将不胜感激。 谢谢 -Jim

0 个答案:

没有答案