-->
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.  [ 1 post ] 
Author Message
 Post subject: Unique constraint violated
PostPosted: Wed Feb 16, 2005 5:08 pm 
Newbie

Joined: Wed Feb 16, 2005 4:52 pm
Posts: 1
Location: Calgary, AB, Canada
Having a bit of a problem here with a unique constraint. I have a collection that references the following table:

pkid_associate_region
fkid_associate
fkid_region
value

The table has a unique constraint on (fkid_associate, fkid_region). In other words, each associate record can have only 1 value per region.

However, if the user deletes a record and then creates a new one in the same region that was deleted, it violates the unique constraint because it tries to perform the SQL inserts before the deletes.

Is there any way to force Hibernate to process the deletes from the collection before the inserts?

I'm calling saveOrUpdate() on the parent object which updates/inserts/deletes all of the child objects in the same transaction.

Hibernate version: 2.1.7c, 24.11.2004

Name and version of the database you are using: mysql Ver 12.22 Distrib 4.0.18, for pc-linux (i686)


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

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.