'java.lang.NullPointerException' while persisting an entity with an associated null embeddable in Hibernate

Solution In Progress - Updated -

Issue

  • An entity is defined with an optional association with an embeddable which has a @PreUpdate annotated method.
  • When persisting an entity with a null embeddable, a NullPointerException is raised:

    ... java.lang.RuntimeException: java.lang.NullPointerException
        at org.hibernate.jpa.event.internal.EmbeddableCallback.performCallback(EmbeddableCallback.java:48)
        at org.hibernate.jpa.event.internal.CallbackRegistryImpl.callback(CallbackRegistryImpl.java:97)
        at org.hibernate.jpa.event.internal.CallbackRegistryImpl.preCreate(CallbackRegistryImpl.java:57)
        at org.hibernate.event.internal.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:112)
        at org.hibernate.event.internal.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:192)
        at org.hibernate.event.internal.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:135)
        ...
    

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.2
    • 7.3

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content