Bonjour,
J'ai un problème :
Repeated column in mapping for entity: com.anathec.business.Dose column: id_product (should be mapped with insert="false" update="false")
Voici mes tables :
Et mon code :
Code:
@Entity
@Table(name = "dose", catalog = "anathec")
public class Dose implements Serializable {
private DoseId id;
private Product product;
private ProductConcentration productConcentration;
private double dailyProductDose;
public Dose() {
}
@EmbeddedId
@AttributeOverrides({
@AttributeOverride(name = "idProduct", column = @Column(name = "id_product", nullable = false)) })
public DoseId getId() {
return this.id;
}
public void setId(DoseId id) {
this.id = id;
}
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "id_product", nullable = false, insertable = false, updatable = false)
public Product getProduct() {
return this.product;
}
public void setProduct(Product product) {
this.product = product;
}
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumns({
@JoinColumn(name = "id_product", referencedColumnName = "id_product", nullable = false),
@JoinColumn(name = "id_product_concentration", referencedColumnName = "id_product_concentration", nullable = false) })
public ProductConcentration getProductConcentration() {
return this.productConcentration;
}
public void setProductConcentration(ProductConcentration productConcentration) {
this.productConcentration = productConcentration;
}
@Column(name = "daily_product_dose", nullable = false, precision = 22, scale = 0)
public double getDailyProductDose() {
return this.dailyProductDose;
}
public void setDailyProductDose(double dailyProductDose) {
this.dailyProductDose = dailyProductDose;
}
}
J'ai un peu simplifier l'objet pour que ce soir plus compréhensible.
Comment faire pour avoir le résultat voulus comme dans le graph?
Merci,