RequestFactory complex scenario

33 views
Skip to first unread message

bond

unread,
Jul 17, 2012, 6:58:06 AM7/17/12
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
Reply all
Reply to author
Forward
0 new messages