Regular |
|
Joined: Thu Jul 29, 2004 11:55 pm Posts: 75
|
Hi,
We are using hibernate 2.1.7.c and 2.1.6 with ehcache 0.9. We have a few tables/objects in a set where the first object has its fields set to null when we read it from the cache. It is very easy to reproduce by loading all the objects from the DB/cache twice and it occurs with multiple tables. Has anyone seen this problem before? I have a stack trace and could provide the full hibernate log (on request since it is a couple of thousand lines). Here is the stack trace:
[18:32:49.894] [DEBUG] [net.sf.hibernate.impl.SessionImpl] - transaction completion
Exception in thread "main" java.lang.NullPointerException
at com.reddline.oms.model.Bay.hashCode(Bay.java:286)
at java.util.HashMap.hash(HashMap.java:264)
at java.util.HashMap.put(HashMap.java:382)
at net.sf.hibernate.collection.Set.snapshot(Set.java:40)
at net.sf.hibernate.collection.PersistentCollection.getSnapshot(PersistentCollection.java:325)
at net.sf.hibernate.impl.SessionImpl$CollectionEntry.postInitialize(SessionImpl.java:359)
at net.sf.hibernate.impl.SessionImpl.initializeCollectionFromCache(SessionImpl.java:4013)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3297)
at net.sf.hibernate.collection.PersistentCollection.forceInitialization(PersistentCollection.java:336)
at net.sf.hibernate.impl.SessionImpl.initializeNonLazyCollections(SessionImpl.java:3156)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2152)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.ManyToOneType.assemble(ManyToOneType.java:108)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:56)
at net.sf.hibernate.impl.CacheEntry.assemble(CacheEntry.java:48)
at net.sf.hibernate.impl.SessionImpl.assembleCacheEntry(SessionImpl.java:2147)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2125)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:2000)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1962)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:204)
at net.sf.hibernate.type.EntityType.nullSafeGet(EntityType.java:126)
at net.sf.hibernate.impl.IteratorImpl.postNext(IteratorImpl.java:93)
at net.sf.hibernate.impl.IteratorImpl.<init>(IteratorImpl.java:64)
at net.sf.hibernate.hql.QueryTranslator.iterate(QueryTranslator.java:869)
at net.sf.hibernate.impl.SessionImpl.iterate(SessionImpl.java:1618)
at net.sf.hibernate.impl.QueryImpl.iterate(QueryImpl.java:27)
at com.reddline.oms.picksystem.model.PickSystemDataAccessor.runQuery(PickSystemDataAccessor.java:380)
at com.reddline.oms.picksystem.model.PickSystemDataAccessor.main(PickSystemDataAccessor.java:358)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78)
The null pointer occurs when trying to hash the object and the hashcode depends on the fields. Hibernate is getting the object from the cache. It works fine on the initial load and fails on the second load. Any help would be greatly appreciated.
chuck
|
|