| It seems that this PR hasn't fixed @JoinColumn -annotation with ConstraintMode.NO_CONSTRAINT. I still have "Cannot add or update a child row: a foreign key constraint fails (`dbname`.`#sql-c5c_2f0e`, CONSTRAINT `FK2pkh6qroghn6tupgw1wpykm2o` FOREIGN KEY (`product_id`) REFERENCES `kone_product` (`id`))" when trying to start the application. Log.java
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "product_id", foreignKey = @ForeignKey(name = "fk_kone_log_kone_product", value = ConstraintMode.NO_CONSTRAINT))
public Product getProduct() {
return product;
}
Product.java
@OneToMany(targetEntity = KoneLog.class, mappedBy = "product", fetch = FetchType.LAZY)
public List<KoneLog> getLogs() {
return logs;
}
Same problem with modified code: Log.java
@ManyToOne(fetch = FetchType.LAZY, optional = true)
@JoinColumn(name = "product_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
public Product getProduct() {
return product;
}
Product.java
@Transient
public List<KoneLog> getLogs() {
return logs;
}
And even if I take logs completely away from Product.java I got the same error message. |