-->
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.  [ 1 post ] 
Author Message
 Post subject: Problems loading object graph
PostPosted: Fri Dec 17, 2004 4:20 pm 
Regular
Regular

Joined: Thu Jul 29, 2004 11:55 pm
Posts: 75
Hi,

We are using Hiberant 2.1.6 on Redhat linux running JDK1.5.0 and our DB is MaxDB. We have large object graphs that we load (sometimes up to 5 table joins). We are having the problem where the objects lower down in the graph are not fully created before being set in an object higher up in the graph. I will give an example:

Object A contains object B. Hibernate is mapped to load A and B together (not lazy).

When we load object A and hibernate calls A.setB(B) and A.setB() calls B.getX(), X is not been set and returns null even though it is set to not-null in the mapping. Basically, object B is being set before it is completely loaded/populated.

I have used this simple example because the amount of code and mappings is extensive for the problem.

One note: the problem is not consistent. Some mappings occurred all the time and we rewrote the way we mapped/created the object graphs. Now, it is occurring randomly where it occurs on say 10 objects in a list of 100.

I have a stack trace that shows the problem. The null pointer occurs because the hashCode() method uses a property of bay which is set to not-null, but it is null because it has not been set. If you need more information, please let me know. Thanks for any help.

[12:55:59.092] [ERROR] [PersistentCollection] - Failed to lazily initialize a collection
net.sf.hibernate.PropertyAccessException: Exception occurred inside setter of com.reddline.oms.picksystem.model.PickList.picks
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:49)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:222)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2210)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1991)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1953)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:204)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2205)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:990)
at net.sf.hibernate.loader.Loader.loadCollection(Loader.java:965)
at net.sf.hibernate.loader.OneToManyLoader.initialize(OneToManyLoader.java:93)
at net.sf.hibernate.collection.AbstractCollectionPersister.initialize(AbstractCollectionPersister.java:284)
at net.sf.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:3268)
at net.sf.hibernate.collection.PersistentCollection.initialize(PersistentCollection.java:195)
at net.sf.hibernate.collection.PersistentCollection.read(PersistentCollection.java:71)
at net.sf.hibernate.collection.Set.iterator(Set.java:130)
at com.reddline.oms.picksystem.model.PickList.sortPicks(PickList.java:342)
at com.reddline.oms.picksystem.model.PickList.setPicks(PickList.java:90)
at sun.reflect.GeneratedMethodAccessor142.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:38)
at net.sf.hibernate.persister.AbstractEntityPersister.setPropertyValues(AbstractEntityPersister.java:222)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2210)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:911)
at net.sf.hibernate.loader.Loader.loadEntity(Loader.java:931)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:59)
at net.sf.hibernate.loader.EntityLoader.load(EntityLoader.java:51)
at net.sf.hibernate.persister.EntityPersister.load(EntityPersister.java:419)
at net.sf.hibernate.impl.SessionImpl.doLoad(SessionImpl.java:2117)
at net.sf.hibernate.impl.SessionImpl.doLoadByClass(SessionImpl.java:1991)
at net.sf.hibernate.impl.SessionImpl.internalLoad(SessionImpl.java:1953)
at net.sf.hibernate.type.ManyToOneType.resolveIdentifier(ManyToOneType.java:69)
at net.sf.hibernate.type.EntityType.resolveIdentifier(EntityType.java:204)
at net.sf.hibernate.impl.SessionImpl.initializeEntity(SessionImpl.java:2205)
at net.sf.hibernate.loader.Loader.initializeEntitiesAndCollections(Loader.java:315)
at net.sf.hibernate.loader.Loader.doQuery(Loader.java:305)
at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:133)
at net.sf.hibernate.loader.Loader.doList(Loader.java:1033)
at net.sf.hibernate.loader.Loader.list(Loader.java:1024)
at net.sf.hibernate.loader.SQLLoader.list(SQLLoader.java:92)
at net.sf.hibernate.impl.SessionImpl.findBySQL(SessionImpl.java:3806)
at net.sf.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:52)
at net.sf.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:550)
at com.reddline.oms.picksystem.model.PickSystemDataAccessor.getZone(PickSystemDataAccessor.java:107)
at com.reddline.oms.picksystem.PickSystem.onEvent(PickSystem.java:85)
at com.reddline.oms.eventsystem.AbstractEventSystem.fireEvent(AbstractEventSystem.java:160)
at com.reddline.oms.eventsystem.AbstractEventSystem.processEvent(AbstractEventSystem.java:139)
at com.reddline.oms.eventsystem.BasicEventSystem$1.run(BasicEventSystem.java:59)
at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:748)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor142.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at net.sf.hibernate.property.BasicPropertyAccessor$BasicSetter.set(BasicPropertyAccessor.java:38)
... 65 more
Caused by: java.lang.NullPointerException
at com.reddline.oms.model.Bay.hashCode(Bay.java:281)
at java.util.HashMap.hash(HashMap.java:264)
at java.util.HashMap.getEntry(HashMap.java:360)
at java.util.LinkedHashMap.get(LinkedHashMap.java:273)
at com.reddline.oms.picksystem.model.PickList.addInactivePick(PickList.java:296)
at com.reddline.oms.picksystem.model.PickList.sortPicks(PickList.java:354)
at com.reddline.oms.picksystem.model.PickList.setPicks(PickList.java:90)
... 69 more


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.