-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: reordering a list in one transaction (delete before insert)
PostPosted: Thu Feb 22, 2007 7:00 pm 
Newbie

Joined: Wed Jan 24, 2007 9:35 am
Posts: 7
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?


Top
 Profile  
 
 Post subject: Re: reordering a list in one transaction (delete before insert)
PostPosted: Wed Jan 25, 2012 6:01 am 
Newbie

Joined: Wed Jan 25, 2012 5:55 am
Posts: 1
did you try a flush() after delete and before insert


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.