-->
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: null index column for collection
PostPosted: Sun Jun 13, 2010 2:52 pm 
Beginner
Beginner

Joined: Sat Sep 12, 2009 10:20 am
Posts: 44
I am getting the stack below yet my database doesn't have any nulls..

Here's the error, my query to prove there are no nulls, and my annotations..

Code:
org.hibernate.HibernateException:null index column for collection: com.conducive.data.pojo.Contact.websiteMetrics org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:771)
org.hibernate.collection.PersistentList.readFrom(PersistentList.java:402)
org.hibernate.loader.Loader.readCollectionElement(Loader.java:1052)
org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
org.hibernate.loader.Loader.doQuery(Loader.java:745)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
org.hibernate.loader.Loader.doList(Loader.java:2294)
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
org.hibernate.loader.Loader.list(Loader.java:2167)
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)


Code:
mysql> select * from Contact_WebsiteMetrics where websiteMetrics_order is null;
Empty set (0.00 sec)


Code:
   
@ManyToMany(fetch = FetchType.EAGER)
@IndexColumn(name = "websiteMetrics_order")
@IndexedEmbedded
private List<WebsiteMetrics> websiteMetrics = new ArrayList<WebsiteMetrics>();


Top
 Profile  
 
 Post subject: Re: null index column for collection
PostPosted: Sun Jun 13, 2010 4:13 pm 
Beginner
Beginner

Joined: Sat Sep 12, 2009 10:20 am
Posts: 44
From what I can tell it is happening when I'm using the Criteria API to load a List<Person> and the list contains a Person which has no metrics.


Top
 Profile  
 
 Post subject: Re: null index column for collection
PostPosted: Sun Jun 13, 2010 4:31 pm 
Beginner
Beginner

Joined: Sat Sep 12, 2009 10:20 am
Posts: 44
I think this may be a bug in hibernate.

If the list is marked EAGER, but empty, the left join will return nulls for the index column.
Then this error is thrown.

D/


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.