-->
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.  [ 10 posts ] 
Author Message
 Post subject: NULL entries inserted for missing <list> elements
PostPosted: Fri May 20, 2005 9:38 am 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
I have a <list> with a many-to-many association. Now, under Hibernate 2.1.8 when there's an element missing (meaning there's a gap in the index column) it would not insert an entry for the missing element. When selecting, it would insert a null element into the List.

Now with Hibernate 3, it wants to insert an entry where the back reference is null (which is not allowed).

Does someone have an idea why this behaviour is different in Hibernate 3 and how to go about making it behave as under Hibernate 2? Any help is appreciated.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 9:53 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
If there is truly a change in behavior here, it would be a bug, and you should submit an ultra-simple, runnable test case to JIRA that reproduces this.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 10:04 am 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
I'm not quite sure if there is a change. I think you should know better than I ;)


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 11:58 am 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
Okay, I've done some tests: Whenever the _last_ element in the list is null it wants to insert a NULL child reference. It does work with other list indices being null, however. Only the last index is problematic.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 12:24 pm 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
It looks like PersistentList.entryExists() returns true when the specified entry is non-null or the specified index is the last of the list (as has been mentioned at http://forum.hibernate.org/viewtopic.php?t=934884&highlight=entryexists, too).

Unfortunately, there is no mention as to why it would return true on the last index, but not on others. Exactly that is giving us problems here.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 1:18 pm 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
This is the source: http://opensource.atlassian.com/project ... se/HB-1249

This change makes Hibernate 3 behave differently from Hibernate 2. The problem is that the schema exporter is still creating a non-null column which is breaking our application.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 2:04 pm 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
I've filed a bug report at http://opensource.atlassian.com/projects/hibernate/browse/HHH-510


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 3:28 pm 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
Looks like Gavin rejected my bug report with a (decidedly quite arrogant) response:

Quote:
This "null elements at end of list" is an incredibly corner case, stinks to high heaven, and we should not make any further changes to allow such broken data.

Think what some future application is going to make of your horrible data model.


I'm not quite sure what to think of that. On the one hand, Hibernate allows to insert null elements into lists, and that is good. But on the other hand, you can't have a null element at the very last position because the schema generator doesn't allow for NULL values which Hibernate wants to insert.

What kind of weird sense does that make?


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 3:30 pm 
Newbie

Joined: Thu Jul 15, 2004 7:43 am
Posts: 16
And aside from that, I'm more than open for a suggestion if our data model is that broken and is stinking to high heaven. Apparently Gavin does have some knowledge we don't have.


Top
 Profile  
 
 Post subject:
PostPosted: Fri May 20, 2005 3:49 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
For future reference: insulting people who give you free things is simply out of order and not tolerated here.


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