-->
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: null objects in PersistentList
PostPosted: Mon Jan 30, 2006 5:42 pm 
Beginner
Beginner

Joined: Thu Oct 27, 2005 11:53 am
Posts: 42
3.1.2

Mapping documents:
<list name="referenceList">
<key column="parenttableModelId"/>
<list-index column="id"/>
<one-to-many class="com.myvision.model.Reference"/>
</list>

Code between sessionFactory.openSession() and session.close():

Session s = HibernateUtil.currentSession();
Criteria c = s.createCriteria(TableModel.class);
List<TableModel> list = c.list();
for (TableModel tableModel: list) {
if(tableModel!=null) {
System.err.println( tableModel.getReferenceList().size() );

}
}
HibernateUtil.closeSession();


MYSQL 4 [b]

[b] sql

select referencel0_.parenttableModelId as parentt11_1_, referencel0_.id as id1_, referencel0_.id as id186_0_, referencel0_.lastModified as lastModi2_186_0_, referencel0_.creationDate as creation3_186_0_, referencel0_.version as version186_0_, referencel0_.defaultValue as defaultV5_186_0_, referencel0_.name as name186_0_, referencel0_.ordr as ordr186_0_, referencel0_.property as property186_0_, referencel0_.selectionPath as selectio9_186_0_, referencel0_.showInTable as showInT10_186_0_

from reference referencel0_ where referencel0_.parenttableModelId=167

java

private java.util.Collection referenceList ;

list impl

PersistentList

Hi All,

I always have a lot of null objects in the PersistentList. I also have the objects that should be there. When I iterate the list I get null from it.next(). The size() method gives also around 700 while there are only 11 real entries.Does anybody know what can be wrong?

grts,
Dennis


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 7:22 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 3:00 pm
Posts: 1816
Location: Austin, TX
http://www.hibernate.org/hib_docs/v3/re ... ns-indexed


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 30, 2006 7:33 pm 
Beginner
Beginner

Joined: Thu Oct 27, 2005 11:53 am
Posts: 42
thanks, i better use set i guess


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jan 31, 2006 5:14 pm 
Beginner
Beginner

Joined: Thu Oct 27, 2005 11:53 am
Posts: 42
i am affraid i have to get back on this. I now use bag and still i have the same problem. In my previous situation when i used list I had the id column as index so there was nothing wrong also. Maybe I missed something I could not make up from to documentation?


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.