This content has been marked as final.
Show 4 replies
-
1. Re: EntityManger.merge() and Cascade.Remove
alximik Oct 31, 2005 6:34 AM (in response to hfarid)merge won't delete such objects. You can try hibernate's org.hibernate.annotations.CascadeType.DELETE_ORPHAN annotation.
But I'm thinking its a kludge. Better delete the objects yourself in setEquivalentTags method.@OneToMany(cascade = CascadeType.ALL, mappedBy="tag", fetch=FetchType.EAGER ) @org.hibernate.annotations.Cascade({org.hibernate.annotations.CascadeType.ALL, org.hibernate.annotations.CascadeType.DELETE_ORPHAN } ) public Set<EquivalentTag> getEquivalentTags() .....
-
2. Re: EntityManger.merge() and Cascade.Remove
hfarid Oct 31, 2005 8:32 PM (in response to hfarid)works very nicely for a kludge :-)
I am kinda surprised that merge does not delete the many side of the relation since it does create/update when needed
anyway, thanks for the hint. -
3. Re: EntityManger.merge() and Cascade.Remove
tonylai Nov 1, 2005 3:24 AM (in response to hfarid)To epbernard:
Yes, DELETE_ORPHAN can resolve the problem, but it's really not graceful and untransplantable. The entity bean is tightly bounded with hibernate persist. For hibernate 2, there's no DELETE_ORPHAN. And we are all confused why you guys import such a unusable feature? -
4. Re: EntityManger.merge() and Cascade.Remove
epbernard Nov 4, 2005 5:27 AM (in response to hfarid)"tonylai" wrote:
To epbernard:
Yes, DELETE_ORPHAN can resolve the problem, but it's really not graceful and untransplantable. The entity bean is tightly bounded with hibernate persist. For hibernate 2, there's no DELETE_ORPHAN. And we are all confused why you guys import such a unusable feature?
Stop claiming false statements. It's not my fault if the EJB3 EG has decided not to standardize this feature. Every single EJB3 implementor will need an extra annotation to support that.
And of course, delete-orphan was part of hibernate2!!
Annotation makes no change in the way to use that feature compared to Hibernate core.