Hibernate version: 3.0.2
Hi,
When I fetch an object from the database using
Code:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="com.dialog.listserv.model" >
<class name="ItemGroup" lazy="false">
<id name="id"><generator class="native"/></id>
<property name="title" length="255">
<column name="title" not-null="true" unique-key="BUSINESS_KEY"/>
<column name="title" not-null="true" unique-key="UNIQUE_TITLE_AT_LEVEL"/>
</property>
<property name="description" length="512"/>
<property name="emailConfirmAtSubscrip" not-null="true"/>
<property name="creationDate" update="false">
<column name="creationDate" not-null="true" sql-type="TIMESTAMP" unique-key="BUSINESS_KEY"/>
</property>
<many-to-one name="parentItemGroup" cascade="none" fetch="join">
<column name="PARENT_GROUP_ID" not-null="false" unique-key="UNIQUE_TITLE_AT_LEVEL"/>
</many-to-one>
<set name="childItemGroups" cascade="all-delete-orphan" inverse="true" fetch="join">
<key column="PARENT_GROUP_ID"/>
<one-to-many class="ItemGroup"/>
</set>
<many-to-one name="publisher" class="Publisher" update="false" cascade="none" fetch="join">
<column name="PUBLISHER_ID" not-null="true" unique-key="UNIQUE_TITLE_AT_LEVEL"/>
</many-to-one>
<set name="invitedForeigners" table="ACCOUNT_ITEMGROUP" fetch="join" cascade="save-update">
<key column="GROUP_ID"/>
<many-to-many class="Account" column="ACCOUNT_ID"/>
</set>
<set name="itemRefs" table="ITEMREF" cascade="all-delete-orphan" fetch="join" outer-join="false" >
<key column="GROUP_ID"/>
<one-to-many class="ItemRef"/>
</set>
<property name="availableForSubscribers" not-null="true"/>
</class>
</hibernate-mapping>
....
return (ItemGroup) session.get(ItemGroup.class, itemId, LockMode.UPGRADE);
....
I can see the select being done with all the properties returned. I see that my class empty constructor is being called, and the method hashCode is called before any of my class' setters method had a chance to be called.
This provokes a NullPointerException in my hashCode method!
Can someone please help me?
Thanks