Hibernate version:3.1
Mapping documents:
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">
<!-- Generated Oct 4, 2006 1:09:02 PM by Hibernate Tools 3.1.0.beta4 -->
<hibernate-mapping default-cascade="save-update">
<class name="business.domain.UserFo" table="USER_FO">
<id name="id" type="java.lang.Long" unsaved-value="null">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="ID" precision="15" scale="0" />
<generator class="sequence">
<param name="sequence">USER_FO_ID</param>
</generator>
</id>
<version name="version" type="java.lang.Long">
<column name="VERSION" precision="15" scale="0" not-null="true" />
</version>
<many-to-one name="usersByInsertUserId" class="business.domain.User" fetch="select" cascade="none">
<column name="INSERT_USER_ID" precision="15" scale="0" not-null="true" />
</many-to-one>
<many-to-one name="usersByLastUpdateUserId" class="business.domain.User" fetch="select" cascade="none">
<column name="LAST_UPDATE_USER_ID" precision="15" scale="0" not-null="true" />
</many-to-one>
<many-to-one name="usersByUsersId" class="business.domain.User" fetch="select">
<column name="USERS_ID" precision="15" scale="0" not-null="true" />
</many-to-one>
<many-to-one name="hudOffice" class="business.domain.HudOffice" fetch="select" cascade="none">
<!--Lana many-to-one name="hudOffice" class="business.domain.HudOffice" fetch="select"-->
<column name="HUD_OFFICE_ID" precision="15" scale="0" not-null="true" />
</many-to-one>
<many-to-one name="profileStatus" class="business.domain.ProfileStatus" fetch="select" cascade="none">
<!--Lana many-to-one name="profileStatus" class="business.domain.ProfileStatus" fetch="select"-->
<column name="PROFILE_STATUS_ID" precision="15" scale="0" not-null="true" />
</many-to-one>
<property name="statusUpdateUserId" type="java.lang.Long">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="STATUS_UPDATE_USER_ID" precision="15" scale="0" not-null="true" />
</property>
<property name="statusUpdateTimestamp" type="timestamp">
<meta attribute="use-in-tostring">true</meta>
<meta attribute="use-in-equals">true</meta>
<column name="STATUS_UPDATE_TIMESTAMP" length="7" not-null="true" />
</property>
<property name="insertTimestamp" type="timestamp">
<meta attribute="use-in-tostring">true</meta>
<column name="INSERT_TIMESTAMP" length="7" not-null="true" />
</property>
<property name="lastUpdateTimestamp" type="timestamp">
<meta attribute="use-in-tostring">true</meta>
<column name="LAST_UPDATE_TIMESTAMP" length="7" not-null="true" />
</property>
<set name="foProfileStatusHists" inverse="true">
<key>
<column name="FO_USER_ID" precision="15" scale="0" not-null="true" />
</key>
<one-to-many class="business.domain.FoProfileStatusHist" />
</set>
<set name="profileFos" inverse="true" cascade="save-update,delete-orphan">
<!--Lana set name="profileFos" inverse="true"-->
<key>
<column name="USER_FO_ID" precision="15" scale="0" not-null="true" />
</key>
<one-to-many class="business.domain.ProfileFo" />
</set>
</class>
</hibernate-mapping>
Name and version of the database you are using: Oracle 10g
The weird problem I have is that when I have a set of entities (profileFos in the mapping above) in hibernate and attempt to delete one no deletion occurs. I have code where I take the same domain objects and perform the same operations using a standard java.util.HashSet and it works properly. I was using the HashSet to verify my equals and hashcode functions are correct.
In addition if I have 5 of an object in a PersistentSet and then add the exact same 5 objects (equals returns true, and the hashcodes are identical) I seem to get 10 objects in the set. Which doesn't happen with the HashSet class.
Anyone seen this before?