-->
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: Best Way to Deal w/ Database Constraints and List Mappings?
PostPosted: Fri Nov 10, 2006 11:57 am 
Newbie

Joined: Fri Nov 03, 2006 2:05 am
Posts: 3
I'm wondering if anyone has any recommendations on how to deal with database constraints, especially in regard to List mappings.

Here's my situation:

* I have a parent-child relationship. The child is collection is ordered.
* The database has unique two-column index on the parent_id and seq_no fields in the child table.
* Whenever I am forced to reorder (e.g. by removing the first child element), Hibernate of course is not able to know the order in which to perform the updates, and triggers a constraint violation.

I am able to work around this by manually mucking with the SeqNo of each child element, flushing, then reordering and flushing again, but it's not terribly satisfying. I'm hoping there's a more elegant way.

I've considered writing an Interceptor to scan for this condition, but I don't think I can do it transactionally using this approach.

Does anyone have any suggestions? Perhaps there's some Hibernate feature I've overlooked?

Thanks in advance!


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.