Hibernate version:
3.1.3 & 3.2.2.ga
Mapping documents:
Code:
<natural-id mutable="true">
<property name="idCepS" column="ORGAN_REJ_ID_CEP_S"
type="string" not-null="true" length="38"/>
<property name="dataEwidencyjnaOd" column="DATA_EWIDENCYJNA_OD"
type="timestamp" not-null="true"/>
<property name="dataEwidencyjnaDo" column="DATA_EWIDENCYJNA_DO"
type="timestamp" not-null="true"/>
</natural-id>
Full stack trace of any exception that occurs:Code:
java.lang.NullPointerException
at org.hibernate.engine.StatefulPersistenceContext.getNaturalIdSnapshot(StatefulPersistenceContext.java:266)
at org.hibernate.event.def.DefaultFlushEntityEventListener.checkNaturalId(DefaultFlushEntityEventListener.java:71)
at org.hibernate.event.def.DefaultFlushEntityEventListener.getValues(DefaultFlushEntityEventListener.java:155)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:106)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:985)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:333)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
Name and version of the database you are using:
Oracle 9
Bug in code
I've done some debugging with 3.1.3 version and found out that cause of this error is that StatefulPersistenceContext.getNaturalIdSnapshot(StatefulPersistenceContext.java:261) checks against
NO_ROW while it should check against null as method initialising
entitySnapshot variable can only be array of object or null.