In my case this exception sometimes happens while trying to commit changes on modified entity.
Stack trace from my app:
java.lang.NullPointerException org.hibernate.event.internal.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:148) org.hibernate.event.internal.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:88) org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1213) org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:402) org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101) org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
In my case this exception sometimes happens while trying to commit changes on modified entity.
Stack trace from my app: