-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Persistnace problem with natural-id
PostPosted: Wed Mar 21, 2007 11:29 am 
Newbie

Joined: Wed Mar 21, 2007 11:09 am
Posts: 2
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.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 23, 2007 1:54 pm 
Newbie

Joined: Wed Mar 21, 2007 11:09 am
Posts: 2
fix is pretty simple just change if statement to check against null
do I need to register on JIRA & post a bug /wpatch or some dev will do it ?


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.