[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-5266) NullPointer in toString of PersistentBag

Jan Stolze (JIRA) noreply at atlassian.com
Wed Jul 7 08:18:13 EDT 2010


    [ http://opensource.atlassian.com/projects/hibernate/browse/HHH-5266?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=37659#action_37659 ] 

Jan Stolze commented on HHH-5266:
---------------------------------

Got some more info on this one.
I have figured out that it is the persister which is null in this case.
The test case is that I remove an entity which cannot be removed due to a foreign key constraint

The relation is as follows:
Entity A has a ManyToOne relation to entity B
Entity B doesn't know of A
Now construct a bunch of A's which relate to the same B next try to remove B which cannot be removed because of the relations of A to B.
This will trigger the foreign key constraint and a rollback takes place which notifies the interceptor which logs all received states as passed by the onDelete method call.

> NullPointer in toString of PersistentBag
> ----------------------------------------
>
>                 Key: HHH-5266
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-5266
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.3.2
>            Reporter: Jan Stolze
>
> We have created an interceptor which keeps track of changes during a running transaction so in case of a rollback we can log which changes where issued before the rollback is performed. Now we sometimes see in case a rollback is issued the following stacktrace:
> exception in interceptor afterTransactionCompletion()
> java.lang.NullPointerException
> 	at org.hibernate.event.def.DefaultInitializeCollectionEventListener.initializeCollectionFromCache(DefaultInitializeCollectionEventListener.java:116)
> 	at org.hibernate.event.def.DefaultInitializeCollectionEventListener.onInitializeCollection(DefaultInitializeCollectionEventListener.java:71)
> 	at org.hibernate.impl.SessionImpl.initializeCollection(SessionImpl.java:1744)
> 	at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:366)
> 	at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:108)
> 	at org.hibernate.collection.PersistentBag.toString(PersistentBag.java:506)
> 	at java.lang.String.valueOf(String.java:2826)
> 	at java.lang.StringBuilder.append(StringBuilder.java:115)
> 	at gti.db.DbRollbackLogginInterceptor$LogEntry.toString(DbRollbackLogginInterceptor.java:246)
> 	at java.lang.String.valueOf(String.java:2826)
> 	at java.lang.StringBuilder.append(StringBuilder.java:115)
> 	at gti.db.DbRollbackLogginInterceptor.logRollback(DbRollbackLogginInterceptor.java:109)
> 	at gti.db.DbRollbackLogginInterceptor.afterTransactionCompletion(DbRollbackLogginInterceptor.java:70)
> 	at org.hibernate.impl.SessionImpl.afterTransactionCompletion(SessionImpl.java:455)
> 	at org.hibernate.jdbc.JDBCContext.afterTransactionCompletion(JDBCContext.java:252)
> 	at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:208)
> 	at org.hibernate.ejb.TransactionImpl.rollback(TransactionImpl.java:85)
> We do not have (at this moment) a clear overview of what has happend and what the exact conditions are for this NPE to occur, but think it is still important enough to report.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list