Home  >  Forum  >  Hibernate
Post New Query

org.hibernate.HibernateException: null index column for collection


joined on
April 23,2013
Asked on May 23,2013
Hi All,

I am trying to fetch data from table as Map. But got below error.

Exception in thread "main" org.hibernate.HibernateException: null index column for collection: 
at org.hibernate.persister.collection.AbstractCollectionPersister.readIndex(AbstractCollectionPersister.java:771)
at org.hibernate.collection.PersistentMap.readFrom(PersistentMap.java:281)
at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1052)
at org.hibernate.loader.Loader.readCollectionElements(Loader.java:690)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:630)
at org.hibernate.loader.Loader.doQuery(Loader.java:745)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
at org.hibernate.loader.Loader.loadCollection(Loader.java:2062)
at org.hibernate.loader.collection.CollectionLoader.initialize(CollectionLoader.java:62)
at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:628)
at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:83)
at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1853)
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
at org.hibernate.collection.PersistentMap.entrySet(PersistentMap.java:265)


joined on
March 16,2013
Replied on May 23,2013

You need to use @MapKey or @MapKeyColumn
joined on
October 10,2013
Replied on August 26,2014

yes right. I support saurabh

Write Answer









Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us