Hi!
How to setup cascade delete using JPA annontation?
For example we have Purchase one-to-many Item pojos.
In purchase definition of item
@ManyToOne
@JoinColumn(name="purchase_id", nullable=false, updatable=true)
public Purchase getPurchase() {
return purchase;
}
In item definition of purchase
@OneToMany(targetEntity=Item.class, mappedBy="purchase", fetch =
FetchType.EAGER, cascade = {CascadeType.ALL})
public Set<Item> getItems() {
return items;
}
On Purchase delete will throw exception:
Cannot delete or update a parent row: a foreign key constraint fails
(`items/item`, CONSTRAINT `FKCBE86B0CEAAD847A` FOREIGN KEY (`purchase_id`)
REFERENCES `purchase` (`id`))
Any ideas how to setup cascade delete?
Thanks.
--
View this message in context:
http://www.nabble.com/cascade-delete-in-appfuse-2-tf3395430s2369.html#a9452796
Sent from the AppFuse - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]