title: Coldfusion ORM/Hibernate StaleStateException
body: <p>I'm getting the following errors every time I perform very simple save operations on Coldfusion 9.01 ORM:</p>
  
  <p>Exception in Hibernate operation.
  Either the updated/deleted row does not exist or the session contained stale data. Root cause :org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 </p>
  
  <p>The following code will actually update the object in the database, but this error appears at the bottom of the page, presumably when Coldfusion automatically calls ormFlush() at the end of the request.</p>
  
  <pre><code>&lt;cfscript&gt;
  myDeal = entityloadbypk('serviceCategory',1);
  myDeal.setScName('Automotive1');
  EntitySave(myDeal);
  writedump(myDeal);
  &lt;/cfscript&gt;
  </code></pre>
  
  <p>Here is the object I'm working with, however this same problem occurs when doing this with multiple objects. </p>
  
  <pre><code>&lt;cfscript&gt;
  /** 
  * @persistent 
  * @table y_serviceCategories
  */ 
  component{ 
      property name="scID" fieldtype="id" datatype="int" generator="native"; 
      property string scName; 
      property priority; 
  
      property name="serviceSubCategory" fieldtype="one-to-many" cfc="serviceSubCategory" fkcolumn="scID";
  
      public array function getSubCategoryByPriority(){
          return EntityLoad("serviceSubCategory", {scID=getscID()}, "Priority ASC");
      }
  }
  &lt;/cfscript&gt;
  </code></pre>
  
  <p>My current thought is that there is some stale object (unrelated to the object in the code) in the Hibernate batch that fails every time Hibernate runs an add/update batch.  Please help!!!</p>