-->
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.  [ 4 posts ] 
Author Message
 Post subject: Incredibly broken org.hibernate.collection.PersistentList
PostPosted: Wed Sep 13, 2006 3:24 pm 
Newbie

Joined: Mon Nov 22, 2004 10:38 am
Posts: 9
Hibernate: 3.2CR2
Hibernate Annotations: 3.2CR1

In the debugger I see:

Parent:
childs: java.util.List = { org.hibernate.collection.PersistentList } size=13
[11] = { Child@123 }
[12] = { CHild@456 }

The first 11 (0-10) entries are null, the last two contain the Child entities that this relationship should really have. (Validated in the db)

Has anyone seen this before? Is this a known bug? Should I upgrade? To what version then?

S.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 3:24 am 
Hibernate Team
Hibernate Team

Joined: Mon Aug 25, 2003 9:11 pm
Posts: 4592
Location: Switzerland
This has nothing to do with the EJB3/JPA implementation. Post this in the regular user forum and follow the HowToAskForHelp guidelines.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 14, 2006 5:07 am 
Newbie

Joined: Mon Nov 22, 2004 10:38 am
Posts: 9
christian wrote:
This has nothing to do with the EJB3/JPA implementation. Post this in the regular user forum and follow the HowToAskForHelp guidelines.


I found the cause, so I'll just post that here for reference:

The entity that was showing this weird behaviour was giving me infamous "cannot simultaneously fetch multiple bags" error. So to work around that I annotated one of my List<> One-To-Many relations with @IndexColumn(name = "id").

This turned out to be not such a good solution; if the releation contains for example child objects with ids 12 and 17 then Hibernate will create an array with 17 items, adding the child objects at index 'id' and setting the rest to null.

Duh :)

I now removed @IndexColumn and disable outer join fetching until Hibernate has fixed the 'multiple bags' bug.

S.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 15, 2006 9:15 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
use @Fetch(SUBSELECT) or @Fetch(SELECT)
and no this is not a bug, this is a conceptual limitation of bags and resultsets

_________________
Emmanuel


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