Hi All,
I have a mapping file, an extract of which is below:
Code:
<hibernate-mapping>
<class name="business.requisition.Requisition"
optimistic-lock="version"
table="EPT602">
<id type="long" name="id">
<generator class="sequence">
<param name="sequence">requisitionSequence</param>
</generator>
</id>
<property name="date" not-null="true"/>
<property name="requisitionedPosition"
not-null="true"
type="business.structure.PeopleSoftPosition">
<column name="requisitioned_position"/>
</property>
<many-to-one name="brand" column="brand" foreign-key="EPR602I"/>
</class>
</hibernate-mapping>
I have cut out a lot of detail but the remaining elements appear in their orginal order.
The requisitionedPosition property maps to an instance PeopleSoftPosition which implements net.sf.hibernate.UserType so that it can call a network service to initialise itself through the nullSafeGet method:
Code:
public Object nullSafeGet(ResultSet rs, String[] names, Object owner){ ... }
My problem is that some requirements have changed, and in order to do the look up in PeopleSoftPosition, I now need to know the brand property from the Requisition object.
Within nullSafeGet I have determined that the "owner" of a PeopleSoftPosition is a Requisition object - but apart from id, every field on it is null!
I even tried to reload the Requisition object through a org.springframework.orm.hibernate.support.HibernateDaoSupport class with the following call:
Code:
Requisition req = (Requisition) getHibernateTemplate().load(Requisition.class, id);
but I get back the same result, an object with all other fields apart from id being null.
This is so strange because I use the HibernateDaoSupport ok in other parts of the app. I cannot work out what is going wrong here - am I trying to use a Requisition owner that hasn't yet been initialised? Or can I fix this by changing the order of elements in the mapping?
Any help would be most appreciated!
Rob
:)