bond
unread,Jul 17, 2012, 6:58:06 AM7/17/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to google-we...@googlegroups.com
Hi,
we have this complex scenario:
public Class A{
private long id;
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = false)
private List<A> child = new ArrayList<A>();
@ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY, optional = true)
private A parent;
}
On the client I have a tree showing our objects. I want to edit an item of the tree and change its parent. So I make a request to server in which I persist the item I changed. But in this manner on the server I have an ConstrainViolationException because the old parent still have the object the i changed on his list's child. So, in order to make work this example I have to make 2 requests, the first to modify the old parent's child list, and then a request to modify the item I changed. It's work fine but this not guaratees the transaction.
Any suggestions?
Thanks
Daniele