NullPointerException on update using StatelessSession in Hibernate 7.2.0

Upgrading to Hibernate 7.2, we run into a NullPointerException when calling session.update

java.lang.NullPointerException: Cannot invoke "org.hibernate.event.spi.EventSource.asEventSource()" because "this.source" is null
	at org.hibernate.event.spi.AbstractSessionEvent.getEventSource(AbstractSessionEvent.java:40)
	at org.hibernate.event.spi.AbstractSessionEvent.getSession(AbstractSessionEvent.java:36)
	at org.hibernate.boot.beanvalidation.BeanValidationEventListener.onPreUpdateCollection(BeanValidationEventListener.java:119)
	at org.hibernate.event.service.internal.EventListenerGroupImpl.fireLazyEventOnEachListener(EventListenerGroupImpl.java:127)
	at org.hibernate.internal.StatelessSessionImpl.firePreUpdate(StatelessSessionImpl.java:679)
	at org.hibernate.internal.StatelessSessionImpl.lambda$removeAndRecreateCollections$0(StatelessSessionImpl.java:462)
	at org.hibernate.internal.StatelessSessionImpl.lambda$forEachOwnedCollection$0(StatelessSessionImpl.java:734)
	at org.hibernate.metamodel.mapping.internal.ImmutableAttributeMappingList.forEach(ImmutableAttributeMappingList.java:41)
	at org.hibernate.persister.entity.AbstractEntityPersister.visitAttributeMappings(AbstractEntityPersister.java:5846)
	at org.hibernate.internal.StatelessSessionImpl.forEachOwnedCollection(StatelessSessionImpl.java:718)
	at org.hibernate.internal.StatelessSessionImpl.removeAndRecreateCollections(StatelessSessionImpl.java:459)
	at org.hibernate.internal.StatelessSessionImpl.update(StatelessSessionImpl.java:445)
	at org.hibernate.internal.StatelessSessionImpl.update(StatelessSessionImpl.java:397)

This seems to be a reoccurence of Jira

Thanks for your help

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

I’ve set up a reproducer unit test: NPE reproducer · Arpic/hibernate-test-case-templates@d42a690 · GitHub
But I don’t seem to be able to create a ticket in the issue tracker. The create button does nothing. And there are a bunch of 401 errors reported in the console.

@maxameho_agilent sounds like you’re running into: Jira. It’s a known issue with StatelessSession, you can watch that work item for updates.

As to why you weren’t able to create one, did you log into your existing Atlassian account? Or did you create a new one for Hibernate’s Jira? We can check your account’s details from the admin interface, but you’ll have to share your personal details (account name and email), feel free to DM me if you want.

Thanks for your reply.
It is a similar scenario though I don’t have Envers enabled. But it’s definitely a regression linked to the Envers implementation.
I’m using my existing Atlassian account, I’ll DM you.

Here is the bug ticket: Jira

1 Like