0
@Entity
@Table(name="Product_info")

public class Product {
    private int ProductIndex;
    private int priority;
    private Date dateTime;
    private String action;
    private String status;

    @ManyToOne
    @JoinColumn(name="releaseIndex")
    private Release release;

    @Id
    @GeneratedValue
    @Column(name="id")
    protected int getProductIndex() {
        return ProductIndex;
    }
    protected void setProductIndex(int ProductIndex) {
        this.ProductIndex = ProductIndex;
    }
    public Release getRelease() {
        return release;
    }
    public void setRelease(Release release) {
        this.release = release;
    }
    /*public Region getRegion() {
        return region;
    }
    public void setRegion(Region region) {
        this.region = region;
    }*/
    @Column(name="priority")
    public int getPriority() {
        return priority;
    }
    public void setPriority(int priority) {
        this.priority = priority;
    }
    @Column(name="datetime")
    public Date getDateTime() {
        return dateTime;
    }
    public void setDateTime(Date dateTime) {
        this.dateTime = dateTime;
    }
    @Column(name="action")
    public String getAction() {
        return action;
    }
    public void setAction(String action) {
        this.action = action;
    }
    @Column(name="status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }

    public Product() {
    }

    public Product(int priority, Date dateTime, String action, String status) {
        this.priority = priority;
        this.dateTime = dateTime;
        this.action = action;
        this.status = status;
    }
}


@Entity
@Table(name="release")


public class Release {
    private int releaseIndex;
    private String releaseName;
    private Set<ProductInfo> productInfo = new HashSet<ProductInfo>();

    @Id
    @GeneratedValue
    @Column(name="id")
    protected int getReleaseIndex() {
        return releaseIndex;
    }
    protected void setReleaseIndex(int releaseIndex) {
        this.releaseIndex = releaseIndex;
    }
    @Column(name="name")
    public String getReleaseName() {
        return releaseName;
    }
    public void setReleaseName(String releaseName) {
        this.releaseName = releaseName;
    }
    @OneToMany(mappedBy="release")
    public Set<ProductInfo> getProductInfo() {
        return ProductInfo;
    }
    public void setProductInfo(Set<ProductInfo> productInfo) {
        this.productInfo = productInfo;
    }
}

上記は、ManytoOne 関係を作成したい 2 つのクラスですが、次のエラーが発生します。

4

1 に答える 1

0

このエラーが発生するのは、アノテーションがフィールドやメソッドで一貫していない場合があるためです。AccessTypeを操作したくない場合、最も簡単な解決策は、アノテーションをrelease-fieldからgetReleaseメソッドに移動することです。

于 2012-06-18T12:48:12.467 に答える