Olá galera.
Estou utilizando Netbeans 7, EclipseLink e JavaDB.
Tenho a seguinte classe SellItem:
@Entity
@Table
public class SellItem implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column
@Basic(optional=false)
private Integer id;
@JoinColumn(name="fk_sell")
@NotNull
@ManyToOne(optional=false)
@Valid
@Id
private Sell sell;
@JoinColumn(name="fk_product")
@ManyToOne(optional=false)
@Valid
@Id
private Product product;
@Column(nullable=false)
@Min(1)
private int qnt;
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public int getQnt() {
return qnt;
}
public void setQnt(int qnt) {
this.qnt = qnt;
}
public Sell getSell() {
return sell;
}
public void setSell(Sell sell) {
this.sell = sell;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
}
Quando executo minha aplicação, o seguinte erro acontece:
Exception Description: The @JoinColumns on the annotated element [field addressToSend] from the entity class [class br.com.devmedia.entity.Sell] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referencedColumnName elements must be specified in each such @JoinColumn.
O erro ocorre devido as chaves estrangeiras na classe SellItem.
Alguem sabe como devo proceder?
Obrigado!