|
[
Permalink
| « Hide
]
Gail Badner added a comment - 05/Mar/08 01:38 PM
I made corrections to the workaround in the Description section.
We've run into this problem on Postgres <8.4, which does not support deferred unique constraints yet. I'll attach one possible workaround, which for the updates:
update groupexperimentermap set child=7204, child_index=0 where id=7561; update groupexperimentermap set child=7204, child_index=2 where id=7563; where groupexperimentermap has a constraint "UNIQUE (child, child_index)" first moves any constraint violating rows to child_index = -1. Would it be possible for Hibernate to do the same? Workaround via triggers which checks for any unique constraint violations and performs an extra "UPDATE" statement to change the column used for ordering (here: child_index) to -1.
Attaching an improved version with the table definition.
Since Hibernate does not support deferred constraints either - another possible (and very ugly) workaround is to use a many-to-many relationship instead of a one-to-many.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||