Tom Pierce's Blog : Let the geek times roll.
Updated: 6/20/04; 3:22:03 PM.

 

Subscribe to "Tom Pierce's Blog" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Tuesday, March 9, 2004

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    comment []

I hope that someone smarter than I am will read this and correct me.  It seems that if I name a directory "tags" somewhere in my CVS project, it will not be handled correctly by IBM Websphere Studio 5.1.1 (Eclipse 2.1.2).  When I try to check that directory (a Java package directory) out of CVS, WSAD says "error fetching file revisions". 

I am using CVS for NT, but I AM NOT using a repository prefix.  So, I don't have this known error situation.  I'm not sure if my issue is a WSAD/Eclipse issue, a CVS for NT issue, or just a CVS issue. 

We are working around it by renaming our tags package to taglib.


3:23:36 PM    comment []

Bill Clementson summarizes and responds to a troll on comp.lang.lisp throwing down the gauntlet and challenging the speed of Lisp.  The result?  Code that performs better than C++ and demonstrates how to write highly optimized Common Lisp.
3:00:16 PM    comment []

I'm getting to where the first stop I make when I'm wanting to look up something is Google.  Today, on a whim, I just typed in a phone number I wanted to do a reverse lookup on.  BAM!  Google returns the reverse lookup information along with links to Yahoo Maps! to locate the company. 

Those Google guys are my heros.


7:46:33 AM    comment []

I'm getting slammed this week.  I've 3 or 4 things I want to blog about, but I don't have the time!  I'm going to make a quick list so that I can tease my readership and remind myself of what I want to talk about.

  • Using iPhoto with Gallery
  • Hibernate Synchronizer
  • PLT Scheme, SXML, SXPATH

 


7:43:00 AM    comment []

© Copyright 2004 Tom Pierce.



Click here to visit the Radio UserLand website.

 


March 2004
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Feb   Apr

Search

[sgl dagger]
How this works

Emacs Sources
 tsql-indent.el
 user-add-sql-folding-marks
 remove-line-boundary-in-region
 convert-camel-to-underscore

My Subscriptions
 Funny
 KM