<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : ConstraintException problem</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : ConstraintException problem</description>
  <pubDate>Wed, 10 Jun 2026 12:53:02 -700</pubDate>
  <lastBuildDate>Mon, 19 Oct 2009 14:07:32 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=1524</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>ConstraintException problem : I didn&amp;#039;t want to make it...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5654#5654</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=401" rel="nofollow">kjohnson</a><br /><strong>Subject:</strong> 1524<br /><strong>Posted:</strong> 19-Oct-2009 at 2:07pm<br /><br />I didn't want to make it sound like I'm taking a problem lightly.&nbsp; Since I know that objects are saved to the DB with a positive permanent id I wanted to try and make sure that it wouldn't happen again.&nbsp; I had been working on adding a new feature to our project when the ConstraintException started happening.&nbsp; After I removed the modified code from being executed the exception continued to occur, which is what I originally posted about.&nbsp; I have since done testing while adding the modified code back in to try and prevent the problem occurring again.&nbsp; So far I have not seen it happen a second time.<br><br>I don't think that a missing relationship in the Object Mapper could be the cause, but I will look into that and implementing DB constraints to try and prevent this happening again.<br>]]>
   </description>
   <pubDate>Mon, 19 Oct 2009 14:07:32 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5654#5654</guid>
  </item> 
  <item>
   <title>ConstraintException problem : Be careful! My concern is that...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5652#5652</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=23" rel="nofollow">davidklitzke</a><br /><strong>Subject:</strong> 1524<br /><strong>Posted:</strong> 19-Oct-2009 at 1:34pm<br /><br /><DIV>Be careful!&nbsp;&nbsp; My concern is that you&nbsp;may be&nbsp;fixing the symptom and have not addressed the root cause.</DIV><DIV>&nbsp;</DIV><DIV>Very rarely do we see reports of entities being saved to the database with negative parmanent ids.&nbsp; This can be a very serious problem, and the problem can propagate and go worse over time.&nbsp; One way that this could happen would be if you had a grandparent-parent-child relationship and failed to include all 3 relationships in the Object Mapper.&nbsp; In any case, I would strongly recommend that you try to prevent this error from occurring during the save (perhaps with a DB constraint).</DIV>]]>
   </description>
   <pubDate>Mon, 19 Oct 2009 13:34:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5652#5652</guid>
  </item> 
  <item>
   <title>ConstraintException problem : After doing some more investigating...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5647#5647</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=401" rel="nofollow">kjohnson</a><br /><strong>Subject:</strong> 1524<br /><strong>Posted:</strong> 19-Oct-2009 at 7:13am<br /><br />After doing some more investigating I believe I have found the cause.&nbsp; Somehow an object of the type 'ReceiptDetail' was saved to the database with an Id of '-3'.&nbsp; Correcting this should correct the problem.]]>
   </description>
   <pubDate>Mon, 19 Oct 2009 07:13:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5647#5647</guid>
  </item> 
  <item>
   <title>ConstraintException problem : I&amp;#039;ve started getting a ConstraintException...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5646#5646</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=401" rel="nofollow">kjohnson</a><br /><strong>Subject:</strong> 1524<br /><strong>Posted:</strong> 19-Oct-2009 at 6:26am<br /><br />I've started getting a ConstraintException periodically when when I create a new object through the persistence manager.&nbsp; The problem started this past Friday, usually on one of the first objects my program creates the Model hits the exception with a message of "Column 'Id' is constrained to be unique.&nbsp; Value '-3' is already present."&nbsp; the exception is thrown on the statement 'aReceiptDetail.AddToManager();" and the only time the column 'Id' is touched is at "pPersMgr.GenerateId(aReceiptDetail, ReceiptDetail.IdEntityColumn);".&nbsp; The way that this object is generated has not changed significantly is several weeks, and the NumericIdGenerator has not changed since last year, but for some reason it occasionally assigns an in-use tempid to a newly created object.&nbsp; Any ideas on what could be causing this?]]>
   </description>
   <pubDate>Mon, 19 Oct 2009 06:26:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1524&amp;PID=5646#5646</guid>
  </item> 
 </channel>
</rss>