I am using Jboss 4.0.4.ga and have a OneToMany like this
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER, mappedBy =
"order")
public Collection getLineItems() {
return lineItems;
}
On the other side, I have this:
@ManyToOne
@JoinColumn(name = "order_id")
public Order getOrder() {
return order;
}
I persist an Order with one LineItem. I then clear the collection of LineItems and
repersist (actually call em.merge(Object) ) the Order.
Jboss doesnt appear to delete the underlying row in the LineItem table.
I cant understand from the docs if the cascade = CascadeType.ALL implies that the
contained objects should be deleted from the datastore when they are removed from a
Collection. The docs seem to indicate this is not done for a ManyToMany bc it is not
possible to know if the objects that are removed from a collection are still referenced by
another entity. However, it does seem that in a OneToMany, JBOSS could know enough to
delete the dependent entites from the datastore.
Thanks for any help on this one.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969258#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...