-->
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: Envers 4 NullPointerException
PostPosted: Tue Jan 03, 2012 6:33 pm 
Beginner
Beginner

Joined: Wed Nov 21, 2007 10:24 am
Posts: 25
I'm getting a NullPointerException on line 47 of EnversPreCollectionRemoveEventListenerImpl very consistently. I wasn't sure if it was due to lazy collections or not, but it seems that it fails if they're eagerly fetched or lazily fetched. I'm guessing it has something to do with getLoadedPersister() returning a null value since the comments for it say "This is only available late during the flush cycle". The stack trace is
Quote:
java.lang.NullPointerException
at org.hibernate.envers.event.EnversPreCollectionRemoveEventListenerImpl.onPreRemoveCollection(EnversPreCollectionRemoveEventListenerImpl.java:47)
at org.hibernate.action.internal.CollectionRemoveAction.preRemove(CollectionRemoveAction.java:143)
at org.hibernate.action.internal.CollectionRemoveAction.execute(CollectionRemoveAction.java:104)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:273)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:265)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:188)
at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:323)
at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1081)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:315)
at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73)
... 120 more


Last edited by kjordan2001 on Fri Jan 13, 2012 10:44 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Envers4 NullPointerException in PreCollectionRemove Listener
PostPosted: Tue Jan 03, 2012 7:09 pm 
Beginner
Beginner

Joined: Wed Nov 21, 2007 10:24 am
Posts: 25
In some of my setters for collections where I have orphanRemoval I'm doing it like
Code:
public void setMyCollection(List<MyType> value) {
if (myCollection == null) {
   myCollection = new ArrayList<MyType>();
}
myCollection.clear();
if (value != null) {
   myCollection.addAll(value);
}
}


to satisfy Hibernate's monitoring of collections. I'm not sure if this is somehow causing it, but I don't think Hibernate liked it before when it was just
Code:
myCollection = value;


Top
 Profile  
 
 Post subject: Re: Envers4 NullPointerException in PreCollectionRemove Listener
PostPosted: Fri Jan 13, 2012 10:44 am 
Beginner
Beginner

Joined: Wed Nov 21, 2007 10:24 am
Posts: 25
Does anyone have any ideas? I rolled back to 3.6.x and it worked again so I think it's a bug in Envers 4. I created a bug in JIRA https://hibernate.onjira.com/browse/HHH-6960 but no response there yet either. Has anyone else encountered any problems with Envers 4?


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.