[hibernate-issues] [Hibernate-JIRA] Commented: (HHH-4474) NullPointerException in AuditEventListener#generateBidirectionalCollectionChangeWorkUnits onPostInsert...

Jared Stehler (JIRA) noreply at atlassian.com
Wed Jun 16 14:46:20 EDT 2010


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

Jared Stehler commented on HHH-4474:
------------------------------------

Solution (posted on StackOverflow): http://stackoverflow.com/questions/1764048/nullpointerexception-at-org-hibernate-envers-event-auditeventlistener-generatebid

"I found the solution of my problem. So I'll share it for others.

The reference to the ExtendedEntity caused the problem. ExtendedEntity is an audited class with different subclasses. But Envers does not automatically mark the subclass as audited. The subclass must use the @Audited annotation for the class or any own fields to be audited by Envers.

So a reference to any sublass of ExtendedEntity, that was audited, worked. In my case I've referenced another subclass that was not audited by Envers - and so the NullPointerException was thrown. By simply adding the @Audited annotation to that empty extension of the ExtendedEntity class (no own properties... just a subclass to distinguish another type of entity) and creation of the related versioning table in the database I could close that gap and solve my problem.

Remember to mark subclasses with @Audited at any own field or the class itself - otherwise they aren't audited and you might come across the exact same problem."

Seems like this might be something to address in the documentation?

> NullPointerException in AuditEventListener#generateBidirectionalCollectionChangeWorkUnits onPostInsert...
> ---------------------------------------------------------------------------------------------------------
>
>                 Key: HHH-4474
>                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-4474
>             Project: Hibernate Core
>          Issue Type: Bug
>          Components: envers
>         Environment: <version>1.2.0.GA-hibernate-3.3</version>
>            Reporter: Daniel Bleisteiner
>         Attachments: stacktrace.txt
>
>
> I get the exception attached as file after creating an entity. The mapping works on my development machine... a test server throws that exception. I've tried to search for eny differences in the tables but can't find any so far. The last time a similar error occured I was missing the versioned entry in the version table - these have been filled with the lowest revision available (the same way on my machine as on the test server). So I'm stuck... I have no access to the related source either... maybe this would help!

-- 
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