-->
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: list-index versus natural-id - fight!
PostPosted: Wed Jan 09, 2008 8:10 am 
Newbie

Joined: Wed Jan 09, 2008 7:16 am
Posts: 7
http://forum.hibernate.org/viewtopic.php?t=968296
http://forum.hibernate.org/viewtopic.php?t=966178
http://forum.hibernate.org/viewtopic.php?t=943384
These posts outlined problems with lists on bi-directional associations.

To sum them, you can't have an inverse="true" one-to-many list. Because your list-index will not automatically update. It will be dropped as an inverse property. That will hurt you in a way you wouldn't soon forget.

The working solution is to make many-to-one end of this association insert="false" update="false", drop inverse="true" and have your list-indexes automatically managed.

But! What if I want to make my many-to-one end of association a natural-id? Like,

<natural-id>
<many-to-one name="parent"
not-null="true"
class="Parent"
column="PARENT_ID" />
<property name="outerId" not-null="true" />
</natural-id>

Adding insert="false" update="false" to natural id component seems dumb to me. Any ideas how to combine list-index and natural-id on the other side?
If it isn't possible, what's your considerations on what's better - natural-id or list-index? I can drop (and hopefully emulate it clumsily) least important of them.

P.S. Of course, the current list-index model is broken. You can't really define your list-index at many-to-one side, so it should update even when collection is mapped as inverse. Ideally, list-index should have its own insert and update properties, which one could then turn on to make index update even belonging to inverse end of that mapping.
Otherwise it makes NO sense and causes a lot of confusion.

It's not a program bug, it's semantic fault.


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.