2012-06-18 3 views
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 관계를 만들려는 두 개의 클래스가 있지만 그것은에 대한 유형을 판별 할 수 없습니다 나에게 오류를 제공합니다 : 열의, product_info : 테이블에서 dao.Release [org.hibernate .mapping.Column (release)]많은 Hibernate에서 하나의 관계에

답변

0

주석이 필드 및 때로는 메소드에 일관성이 없기 때문에이 오류가 발생합니다. AccessType을 가지고 놀고 싶지 않다면 release-field에서 getRelease 메소드로 어노테이션을 이동하는 것이 가장 쉬운 해결책이다.

관련 문제