-->
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: NPE when calling query.list
PostPosted: Tue Mar 25, 2008 5:03 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Hi,

I get the exception below when calling query.list() for the following query:

"from Customer"

A test case has already been posted to Jira about a year ago: http://opensource.atlassian.com/project ... e/HHH-2624

For me, it is very hard to reproduce - it happends maybe twice per day. We use second level cache but no query cache.

Any insight into this problems/workarounds?

---

java.lang.NullPointerException

at org.hibernate.persister.entity.AbstractEntityPersister.loadByUniqueKey(AbstractEntityPersister.java:1649)

at org.hibernate.type.EntityType.loadByUniqueKey(EntityType.java:608)

at org.hibernate.type.EntityType.resolve(EntityType.java:382)

at org.hibernate.type.EntityType.nullSafeGet(EntityType.java:204)

at org.hibernate.persister.collection.AbstractCollectionPersister.readElement(AbstractCollectionPersister.java:703)

at org.hibernate.collection.PersistentSet.readFrom(PersistentSet.java:318)

at org.hibernate.loader.Loader.readCollectionElement(Loader.java:1008)

at org.hibernate.loader.Loader.readCollectionElements(Loader.java:646)

at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:591)

at org.hibernate.loader.Loader.doQuery(Loader.java:701)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)

at org.hibernate.loader.Loader.loadCollectionBatch(Loader.java:2032)

at org.hibernate.loader.collection.BatchingCollectionInitializer.initialize(BatchingCollectionInitializer.java:47)

at org.hibernate.persister.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:565)

at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:63)

at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1716)

at org.hibernate.collection.AbstractPersistentCollection.forceInitialization(AbstractPersistentCollection.java:454)

at org.hibernate.engine.StatefulPersistenceContext.initializeNonLazyCollections(StatefulPersistenceContext.java:844)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:241)

at org.hibernate.loader.Loader.doList(Loader.java:2213)

at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)

at org.hibernate.loader.Loader.list(Loader.java:2099)

at org.hibernate.hql.classic.QueryTranslatorImpl.list(QueryTranslatorImpl.java:912)

at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)

at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)

at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 25, 2008 5:58 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
I just verified that this only happends when using the second-level cache.

Sequence to reproduce:

1. Run query "from Customer"

2. Add an entry to Customer#products collection

3. Run query "from Customer" => nullpointerexception in query.list()


This happends everytime, but only with second-level cache (OSCache).

It should be noted that there is extensive use of "property-ref" relations, even in collections.

Could that cause the second-level cache to fail?

I also see from the debug output that "Cached item was locked" happends a lot, could this be the root of the problem?

Thanks in advance for any help!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 31, 2008 3:16 am 
Senior
Senior

Joined: Tue Oct 21, 2003 8:15 am
Posts: 186
Still haven't found a viable work-around :-(

Any ideas folks?


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.