I hate to ask, but I'm having a problem I just can track down.. maybe someone can help...
 
I currently have serveral objects which all have the following relationship to an Audit/Note object where administrators can add a note about a specific object (user account, system device, etc):
 
        <!-- need note mappings -->
        <set role="notes" table="filestore_to_notes">
            <key column="filestore_noteid"/>
            <many-to-many class="eightotwo.fhe.model.audit.hibernate.HibernateNote"/>
        </set>
 
Here the Administrators can add an unlimited amount of notes to the FileStore object.. the note object has the following strucuture:
 
public interface Note extends Persistent {
    String getComment();
    void setComment(String comment);
    Date getDate();
    void setDate(Date date);
    User getUser();
    void setUser(User user);
}
 
and
 
<hibernate-mapping default-cascade="save-update">
    <class name="eightotwo.fhe.model.audit.hibernate.HibernateNote" table="NOTE">
        <id name="id" column="noteid" type="long">
            <generator class="hilo.long"/>
        </id>
 
        <property name="comment" column="comment" type="string"/>
        <property name="date" column="commentdate" type="timestamp"/>
 
        <many-to-one  name="user" class="eightotwo.fhe.model.security.hibernate.HibernateAdministrator" column="administratorid"/>
    </class>
</hibernate-mapping>
 
The problem starts here with the User relationship, the User relationship represents the Administrator who added the note. When I call a .saveOrUpdate() on an object that has a Set of Notes the User field in the Note object is repersisted with a new primary key. I have been reloading all reference objects on the same session but this has not helped either.. is this a bug with the Set relationship somehow?
 
Thanks!
 
Justen Stepka

Reply via email to