-->
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.  [ 3 posts ] 
Author Message
 Post subject: Hibernate List index decrement
PostPosted: Fri Dec 31, 2004 6:24 pm 
Newbie

Joined: Tue Apr 06, 2004 5:07 am
Posts: 3
Hibernate version: 2.1.2

I'm using Hibernate version 2.1.2 and have a question about how Hibernate List indexes are decremented.

I'll explain the scenario.
ObjectA has a list of ObjectB. I want to delete some objects of ObjectB directly without having to remove them explicitly from the list on ObjectA. The outcome is that the objectB's that I delete will also no longer show up on ObjectA's list but I prefer to work with ObjectB directly for this deletion. But if I do this, it seems that I will also have to handle the correct decrement of Hibernate List indexes. Is this a correct assumption? And more importantly has anyone found a cleaner solution to this problem?

Thanks in advance for any help or advice.


Top
 Profile  
 
 Post subject: Deleting a child of object results in null element in list
PostPosted: Wed Jan 05, 2005 2:00 pm 
Newbie

Joined: Tue Apr 06, 2004 5:07 am
Posts: 3
A better rephrasement of my original question.


I have these classes:

Class Parent {
List children; // of Child
}

class Child {
}

The "children" field is mapped using
<list name="children" >
<key column="index_col"/>
<one-to-many class="Child"/>
</list>


Let's suppose that a parent object has children [A, B, C].
If I delete object B directly then the list of children becomes [A, null,
C].
But what I want it to be is [A,C].
Is this a Hibernate bug or feature?


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jan 05, 2005 4:48 pm 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
It's your responsibility to set up your object structure correctly before deleting objects.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.