-->
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: Problem with refresh() when have lazily loaded objects
PostPosted: Mon Jun 29, 2009 3:05 pm 
Newbie

Joined: Thu May 15, 2008 10:04 am
Posts: 7
Location: uk
Hi

Hibernate 3.2.6
Spring 2.5.6
Java 1.4
Oracle 9.2

Im getting a NullPointer exception thrown out of EvictVisitor.evictCollection() when calling session.refresh() on a persistent object. That object contains a lazily loaded object within it (mapped as many-to-one with cascade='all') and that object has a collection within it (mapped as a set with cascade='all-delete-orphan').

There is persistent data for the lazily loaded object, but not for the collection within that.

Debugging into EvictVisitor.evictCollection(), this line returns null so it falls over a couple of lines later.

Code:
CollectionEntry ce = (CollectionEntry) getSession().getPersistenceContext).getCollectionEntries().remove(collection);


Stack Trace is as follows:
Code:
java.lang.NullPointerException
        at org.hibernate.event.def.EvictVisitor.evictCollection Lorg/hibernate/collection/PersistentCollection;)V(EvictVisitor.java:60)
        at org.hibernate.event.def.EvictVisitor.evictCollection(Ljava/lang/Object;Lorg/hibernate/type/CollectionType;)V(EvictVisitor.java:50)
        at org.hibernate.event.def.EvictVisitor.processCollection(Ljava/lang/Object;Lorg/hibernate/type/CollectionType;)Ljava/lang/Object; EvictVisitor.java:32)
        at org.hibernate.event.def.AbstractVisitor.processValue(Ljava/lang/Object;Lorg/hibernate/type/Type;)Ljava/lang/Object;(AbstractVisitor.java:101)
        at org.hibernate.event.def.AbstractVisitor.processValue(I[Ljava/lang/Object;[Lorg/hibernate/type/Type;)V(AbstractVisitor.java:61)
        at org.hibernate.event.def.AbstractVisitor.processEntityPropertyValues([Ljava/lang/Object;[Lorg/hibernate/type/Type;)V(AbstractVisitor.java:55)
        at org.hibernate.event.def.AbstractVisitor.process(Ljava/lang/Object;Lorg/hibernate/persister/entity/EntityPersister;)V(AbstractVisitor.java:123)
        at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(Lorg/hibernate/event/RefreshEvent;Ljava/util/Map;)V(DefaultRefreshEventListener.java:105)
        at org.hibernate.impl.SessionImpl.fireRefresh(Ljava/util/Map;Lorg/hibernate/event/RefreshEvent;)V(SessionImpl.java:911)
        at org.hibernate.impl.SessionImpl.refresh(Ljava/lang/Object;Ljava/util/Map;)V(SessionImpl.java:894)
        at org.hibernate.engine.CascadingAction$3.cascade(Lorg/hibernate/event/EventSource;Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;Z)V(CascadingAction.java:169)
        at org.hibernate.engine.Cascade.cascadeToOne(Ljava/lang/Object;Lorg/hibernate/type/Type;Lorg/hibernate/engine/CascadeStyle;Ljava/lang/Object;Z)V(Cascade.java:268)
        at org.hibernate.engine.Cascade.cascadeAssociation(Ljava/lang/Object;Lorg/hibernate/type/Type;Lorg/hibernate/engine/CascadeStyle;Ljava/lang/Object;Z)V(Cascade.java:216)
        at org.hibernate.engine.Cascade.cascadeProperty(Ljava/lang/Object;Lorg/hibernate/type/Type;Lorg/hibernate/engine/CascadeStyle;Ljava/lang/Object;Z)V(Cascade.java:169)
        at org.hibernate.engine.Cascade.cascade(Lorg/hibernate/persister/entity/EntityPersister;Ljava/lang/Object;Ljava/lang/Object;)V(Cascade.java:130)
        at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(Lorg/hibernate/event/RefreshEvent;Ljava/util/Map;)V(DefaultRefreshEventListener.java:99)
        at org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(Lorg/hibernate/event/RefreshEvent;)V(DefaultRefreshEventListener.java:39)
        at org.hibernate.impl.SessionImpl.fireRefresh(Lorg/hibernate/event/RefreshEvent;)V(SessionImpl.java:902)
        at org.hibernate.impl.SessionImpl.refresh(Ljava/lang/Object;)VSessionImpl.java:886)


It seems like Hibernate is not dealing correctly with the data, so looks suspiciously like a bug to me. Has anyone else come across this?
Cheers


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.