Hi!
The problem is rather simple. I have a bidirectional ordered many-to-many association (that is one end is ordered - a list).
I want to reorder the ordered end, and to do that i simply delete all associations and create them from scratch in the correct order (naive approach). The problem is, that if I do it in a single transaction i get a "not unique" constraint violation. I assume that's because INSERTs are attempted before DELETEs upon transaction commit.
To make this work i have to delete the association, update the object responsible for the handling of association, commit transaction, then follow with the inserts and update & commit again. That's one transaction too much.
I need to do this in a single transaction, any ideas?
|