| 
 I'm going to start by saying that I may have missed something somewhere in the Hibernate documentation, FAQs, or forums.  But, I don't remember seeing direct references to this. It seems that is a bad idea to make both ends of an inverse mapping cascade.  In this situation, Hibernate will try to cascade multiple times when saving new objects that cause a cascade.  The only way I found to prevent it was to remove the cascade attribute on the inverse end of the mapping. OK, a little less talk and a little more coding please.  I had something like this and it was bad:   <!-- Application class -->
  <class name="net.trin.colorreports.reportcomments.dao.valueobjects.Application">
    <id name="id" column="application_id" type="integer">
      <generator class="identity">
      </generator>
    </id>
    <property name="name" type="string" column="application_name">
    </property>
    
    <set name="reports" inverse="true" lazy="false" cascade="all">
     <key column="application_id"/>
     <one-to-many class="net.trin.colorreports.reportcomments.dao.valueobjects.Report" />
    </set>
  </class>
  
  <!-- Report class -->
  <class name="net.trin.colorreports.reportcomments.dao.valueobjects.Report">
   <id name="id" column="report_id" type="integer">
    <generator class="identity"/>
   </id> 
   
   <property name="name" type="string" column="name"/>
   
   <many-to-one name="application" column="application_id" class="net.trin.colorreports.reportcomments.dao.valueobjects.Application" cascade="save-update" />
   
   <set name="comments" inverse="true" lazy="false" cascade="all">
    <key column="comment_id"/>
    <one-to-many class="net.trin.colorreports.reportcomments.dao.valueobjects.SummaryComment" />
   </set>
  </class>
Notice the cascade attributes on the <set> tags.  This created the loop because of the cascade on the <many-to-one> tag I think.  Once I removed the cascade attribute from the <set> tags, everything started working beautifully. 3:43:15 PM
   |