[
https://hibernate.onjira.com/browse/HHH-7085?page=com.atlassian.jira.plug...
]
Eric Dalquist commented on HHH-7085:
------------------------------------
I'll be writing the test case on 2/20 and coordinating in IRC to determine the
appropriate fix to provide via a pull request.
Entities marked as @Immutable that have a @NaturalId fail to be
inserted with NPE
---------------------------------------------------------------------------------
Key: HHH-7085
URL:
https://hibernate.onjira.com/browse/HHH-7085
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Reporter: Eric Dalquist
Due to the work done for HHH-6974 inserting an @Immutable entity with a @NaturalId
results in a NullPointerException
The cause appears to be due to read-only entities not having EntityEntry.getLoadedState()
populated upon insert and StatefulPersistenceContext.getNaturalIdValues assumes that array
will not be null.
{noformat}
Caused by: java.lang.NullPointerException
at
org.hibernate.engine.internal.StatefulPersistenceContext.getNaturalIdValues(StatefulPersistenceContext.java:1755)
at
org.hibernate.engine.internal.StatefulPersistenceContext.loadedStateInsertedNotification(StatefulPersistenceContext.java:1715)
at org.hibernate.engine.spi.EntityEntry.notifyLoadedStateInserted(EntityEntry.java:390)
at org.hibernate.engine.spi.EntityEntry.postInsert(EntityEntry.java:266)
at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:95)
at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:362)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:354)
at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:275)
at
org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:326)
at
org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:52)
at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1127)
at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:325)
at
org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)
at
org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)
at org.hibernate.ejb.TransactionImpl.commit(TransactionImpl.java:73)
... 54 more
{noformat}
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira