Hibernate version: 3rc1
Mapping documents:
Code:
<hibernate-mapping package="com.reservit.plannit.data.bo.common">
<class name="TextBO" table="text">
<composite-id name="textID" class="TextID" unsaved-value="none">
<key-property name="id" column="textid" type="long"/>
<key-property name="langCode" column="langcode" type="string"/>
</composite-id>
<version name="version" type="integer" unsaved-value="null"/>
<property name="text" column="value" type="string"/>
</class>
</hibernate-mapping>
Code:
<class name="CategoryBO" table="roomcategory">
<id name="id" column="roomcategory" type="integer">
<generator class="identity"/>
</id>
<version name="version" type="integer" unsaved-value="null"/>
<map name="name" lazy="true" cascade="save-update" fetch="join">
<key column="textid" property-ref="categoryNameId"/>
<index column="langcode" type="string"/>
<one-to-many class="com.reservit.plannit.data.bo.common.TextBO"/>
</map>
</class>
Code between sessionFactory.openSession() and session.close():Code:
getSession().saveOrUpdate(category);
Full stack trace of any exception that occurs:Code:
java.lang.NullPointerException
at org.hibernate.engine.EntityEntry.getLoadedValue(EntityEntry.java:141)
at org.hibernate.type.CollectionType.getKeyOfOwner(CollectionType.java:269)
at org.hibernate.engine.Collections.updateReachableCollection(Collections.java:105)
at org.hibernate.event.def.FlushVisitor.processCollection(FlushVisitor.java:37)
at org.hibernate.event.def.AbstractVisitor.processValue(AbstractVisitor.java:81)
at org.hibernate.event.def.AbstractVisitor.processValues(AbstractVisitor.java:43)
at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:197)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:190)
at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:70)
at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:669)
at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:293)
at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:86)
at com.reservit.plannit.data.services.hibernate.HibernateManager.saveOrUpdateInNewTx(HibernateManager.java:340)
at com.reservit.plannit.data.services.hibernate.CategoryManagerImpl.saveCategory(CategoryManagerImpl.java:138)
at com.reservit.plannit.data.services.hibernate.CategoryManagerImpl.saveCategory(CategoryManagerImpl.java:116)
at com.reservit.plannit.test.manager.CategoryManagerTest.save(CategoryManagerTest.java:92)
at com.reservit.plannit.test.manager.CategoryManagerTest.testUpdate(CategoryManagerTest.java:82)
at com.reservit.plannit.test.manager.CategoryManagerTest.main(CategoryManagerTest.java:197)
Name and version of the database you are using:hsqldb
Debug level Hibernate log excerpt:Code:
public Object getLoadedValue(String propertyName) {
return loadedState[
( (UniqueKeyLoadable) persister ).getPropertyIndex(propertyName)
];
}
in debbug, i can pointed out that loadedState is null
This exception happend when i update a category object. Creation of a category with the same method dont failed.
The particularity of this object is that Category reference a TextBO object which use a composite key of a sequence number generated by my applicaiton when recquired and an ISO language code set by my application.
Please can somone tell me what have i done wrong?