actually I am calling em.remove(em.merge(order)) now I was under the impression that the cascade=CascadeType.ALL indicated that a remove would remove all the through the relationship not just the intermediary table.
---
Dru Devore
-------- Original Message --------
Subject: Re: Not cascading remove
From: Marina Vatkina <Marina.Vatkina@Sun.COM>
Date: Mon, March 24, 2008 5:22 pm
To: persistence@glassfish.dev.java.net
Dru,
Are you calling em.remove(order) or (replace my names with the actual ones)
order.getItems().remove(item)?
If the latter, it only removes the relationships, not the entities.
Regards,
-marina
Dru Devore wrote:
> I am using ejb 3.0 with an order table and order item table. Wanting to
> see how it works allowing it to create the linking table, and actually
> liking I decided to let it be and worry about more important thing. What
> I have is this
>
> order (the main table)
> order_order_item (the linking table)
> order_item (the item table)
>
> When I do a remove it takes it out ofthe linking table but not out of
> the order_item table.
>
> This is how it looks in the order entity
>
> @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.EAGER)
> private List<OrderItem> orderItemList;
>
> It will add them and query them but it does not want to remove them.
> What am I doing wrong?
>
> ---
> Dru Devore