<?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 : Persistence of entities</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce Classic : Persistence of entities</description>
  <pubDate>Thu, 11 Jun 2026 06:24:11 -700</pubDate>
  <lastBuildDate>Fri, 07 Mar 2008 10:28:39 -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=482</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>Persistence of entities : Here is the tutorial on Persistence...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2661#2661</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> 482<br /><strong>Posted:</strong> 07-Mar-2008 at 10:28am<br /><br />Here is the tutorial on Persistence Order:<DIV>&nbsp;</DIV><DIV><a href="http://www.ideablade.com/forum/uploads/20080307_132827_Persistence_Ord.zip" target="_blank">uploads/20080307_132827_Persistence_Ord.zip</A></DIV>]]>
   </description>
   <pubDate>Fri, 07 Mar 2008 10:28:39 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2661#2661</guid>
  </item> 
  <item>
   <title>Persistence of entities : Before the Business Objects are...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2660#2660</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> 482<br /><strong>Posted:</strong> 07-Mar-2008 at 10:23am<br /><br />Before the Business Objects are saved to the database, all of the temporary IDs are converted to permanent IDs.&nbsp; This means not only fixing up the IDs of the newly created objects, but all references to these objects.&nbsp; However, DevForce can only do this if it knows about the relationship between the two Business Objects.&nbsp; I think that what is happening is that you have not declared this relationship.<DIV>&nbsp;</DIV><DIV>To prove that DEvForce does do this correctly,&nbsp; take the IdeaBlade Tutorial Database, and write a little application that creates an order and an order detail that belongs to the &nbsp;order.&nbsp; Save the two new business objects.&nbsp; You will find that you do not have a problem.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Fri, 07 Mar 2008 10:23:25 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2660#2660</guid>
  </item> 
  <item>
   <title>Persistence of entities : After further investigation, I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2658#2658</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=266" rel="nofollow">Hawkaye1</a><br /><strong>Subject:</strong> 482<br /><strong>Posted:</strong> 07-Mar-2008 at 9:29am<br /><br /><P>After further investigation, I found that the problem is tied to the IdGenerator. I use the IdGenerator to generate the next order number as well as the Unique Id. Everything works fine until I add the Order to the CustomerOrder collection. I show the Unique Id to be fine, it is the OrderNo (-1) that get saved to the database.</P><DIV>&nbsp;</DIV><DIV>&nbsp;&nbsp;&nbsp; Public Shared Function Create(ByVal pManager As PersistenceManager, ByVal pCustomer As Customer) As Order</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Dim aOrder As&nbsp;Order<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder = pManager.CreateEntity(Of Order)()</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' if this object type requires a unique id and you have implemented<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' the IIdGenerator interface implement the following line<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pManager.GenerateId(aOrder, Invoice.IdEntityColumn)<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pManager.GenerateId(aOrder, Order.OrderNoEntityColumn)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ' Add custom code here</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder.AddToManager()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder.RowVersion = 0<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder.Customer = pCustomer<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder.TermId = 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; aOrder.OrderTypeId = 1<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Return&nbsp;aOrder&nbsp;&nbsp;&nbsp; </DIV><DIV>&nbsp;&nbsp; End Function<BR></DIV><DIV>Database Row: (OrderNo&nbsp;in Red)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </DIV><DIV><TABLE style="WIDTH: 762px; HEIGHT: 26px"><T><T><TR><TD>28364</TD><TD><FONT color=#ff0000>-1</FONT></TD><TD>29608</TD><TD>4123</TD><TD>1</TD><TD>1</TD><TD>1045.0000</TD><TD>NULL</TD><TD>NULL</TD><TD>False</TD><TD>NULL</TD><TD>False</TD><TD>False</TD><TD>NULL</TD><TD>NULL</TD><TD>0</TD></TR></T></T></TABLE></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>NextId Table</DIV><DIV>&nbsp;</DIV><DIV>Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NextId&nbsp;&nbsp;&nbsp;&nbsp; DefaultGroupSize</DIV><DIV><TABLE><T><T><TR><TD>Trip</TD><TD>15001</TD><TD>1</TD></TR><TR><TD><FONT color=#cc0000>Order</FONT></TD><TD><FONT color=#cc0000>42869</FONT></TD><TD><FONT color=#cc0000>1</FONT></TD></TR><TR><TD>Pay</TD><TD>1047</TD><TD>1</TD></TR><TR><TD>Customer</TD><TD>6599</TD><TD>1</TD></TR><TR><TD>Driver</TD><TD>5251</TD><TD>1</TD></TR><TR><TD>NULL</TD><TD>NULL</TD><TD>NULL</TD></TR></T></T></TABLE></DIV><span style="font-size:10px"><br /><br />Edited by Hawkaye1 - 07-Mar-2008 at 9:30am</span>]]>
   </description>
   <pubDate>Fri, 07 Mar 2008 09:29:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2658#2658</guid>
  </item> 
  <item>
   <title>Persistence of entities : When I save changes, I get the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2656#2656</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=266" rel="nofollow">Hawkaye1</a><br /><strong>Subject:</strong> 482<br /><strong>Posted:</strong> 07-Mar-2008 at 6:45am<br /><br />When I save changes, I get the error:<DIV>&nbsp;</DIV><DIV>A first chance exception of type 'IdeaBlade.Persistence.PersistenceManagerSaveException' occurred in IdeaBlade.Persistence.dll</DIV><DIV>Additional information: Save failed - Collection was modified; enumeration operation may not execute.</DIV><DIV>&nbsp;</DIV><DIV>All I have to do to get the error (Example: Create a new Order, Create a new OrderDetail, Then add the Order to the CustomerOrders collection.)</DIV><DIV>&nbsp;</DIV><DIV>Order.Create(persMgr)</DIV><DIV>OrderDetail.Create(persMgr, mOrder)</DIV><DIV>mOrderBS.MoveLast()</DIV><DIV>currentOrder = CType(OrderBS.Current, Order)</DIV><DIV>mCustomerOrder = CType(CustomerOrderBS.Current, CustomerOrder)</DIV><DIV>mCustomerOrder.Order = currentOrder</DIV><DIV>&nbsp;</DIV><DIV>Dim pMgrSave As SaveHelper = New SaveHelper(pm)</DIV><DIV>Try<BR>If pMgrSave.SaveAll Then<BR>DevExpress.XtraEditors.XtraMessageBox.Show("Information Saved", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information)<BR>Else<BR>DevExpress.XtraEditors.XtraMessageBox.Show("Nothing to Save", "No changes", MessageBoxButtons.OK, MessageBoxIcon.Information)<BR>End If</DIV><DIV>Catch ex As Exception<BR>DevExpress.XtraEditors.XtraMessageBox.Show("An exception of type " &amp; ex.GetType().ToString() &amp; _<BR>" was encountered. ")<BR>End Try<BR></DIV><DIV>This is my save function:</DIV><DIV>&nbsp;</DIV><DIV>Public Class SaveHelper</DIV><DIV>Private pMgr As PersistenceManager</DIV><DIV>&nbsp;</DIV><DIV>Public Sub New(ByVal persMgr As PersistenceManager)</DIV><DIV>pMgr = persMgr</DIV><DIV>End Sub</DIV><DIV>&nbsp;</DIV><DIV>Public Function SaveAll() As Boolean</DIV><DIV>Dim result As SaveResult</DIV><DIV>&nbsp;</DIV><DIV>If pMgr.HasChanges Then</DIV><DIV>Try</DIV><DIV>result = pMgr.SaveChanges()</DIV><DIV>If result.Ok Then</DIV><DIV>Return True</DIV><DIV>End If</DIV><DIV>Catch ex As Exception</DIV><DIV>DevExpress.XtraEditors.XtraMessageBox.Show("An exception of type " &amp; ex.GetType().ToString() &amp; _</DIV><DIV>" was encountered. ")</DIV><DIV>End Try</DIV><DIV>End If</DIV><DIV>Return False</DIV><DIV>End Function</DIV><DIV>&nbsp;</DIV><DIV>If I retry the save, it will&nbsp;save the tempId to the record and save it to the database. This only happens if I create a new Order </DIV><DIV>Yes, I would like an example to modify the persistence order.<BR></DIV>]]>
   </description>
   <pubDate>Fri, 07 Mar 2008 06:45:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2656#2656</guid>
  </item> 
  <item>
   <title>Persistence of entities : Persistemce Order is a property...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2640#2640</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> 482<br /><strong>Posted:</strong> 05-Mar-2008 at 9:25am<br /><br />Persistemce Order is a property of the Save operation and is not a property of the Business Objects themselves.&nbsp; We used to include a tutorial on Persistence Order, but after we implemented automatic calculaion of a default Persistence Order a few years ago,&nbsp;we dropped the tutorial since we couldn't find any real life examples of situations where we would want to modify the Persistence Order.<DIV>&nbsp;</DIV><DIV>Why are you trying to modify thE Default Persistence Order?&nbsp; BTW, Your error message about modifying a readonly entity has nothing to do with Persistence Order,</DIV><DIV>&nbsp;</DIV><DIV>I can send you an example of modifying the Persistence Order if you wish.</DIV>]]>
   </description>
   <pubDate>Wed, 05 Mar 2008 09:25:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2640#2640</guid>
  </item> 
  <item>
   <title>Persistence of entities : Do you have an example of how...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2639#2639</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=266" rel="nofollow">Hawkaye1</a><br /><strong>Subject:</strong> 482<br /><strong>Posted:</strong> 05-Mar-2008 at 8:37am<br /><br />Do you have an example of how to modify the persistence order, any attempt I have made says the colloection is readonly.]]>
   </description>
   <pubDate>Wed, 05 Mar 2008 08:37:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=2639#2639</guid>
  </item> 
  <item>
   <title>Persistence of entities : Thanks, regaring those rare cases,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1561#1561</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=52" rel="nofollow">Yaron</a><br /><strong>Subject:</strong> 482<br /><strong>Posted:</strong> 10-Oct-2007 at 9:21pm<br /><br /><P>Thanks, regaring those rare cases, Has anybody been able to Isolate those scenarios, it will help alot if I can know them before building my Save methods</P><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Wed, 10 Oct 2007 21:21:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1561#1561</guid>
  </item> 
  <item>
   <title>Persistence of entities : The most likely cause is that...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1537#1537</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> 482<br /><strong>Posted:</strong> 10-Oct-2007 at 11:30am<br /><br /><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-bidi-font-size: 9.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN">The most likely cause is that the Persistence Order is incorrect.&nbsp; The Persistence Order is by default set automatically by the Persistence Manager through the use of a "reverse topological sort". <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-bidi-font-size: 9.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN">&nbsp;<o:p></o:p></SPAN></P><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt"><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-bidi-font-size: 9.0pt; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN">If the Persistence Order is incorrect</SPAN><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN">, you will need to override it with your own order using the SaveOptions of SaveChanges.</P><DIV></SPAN><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN"></SPAN>&nbsp;</DIV><DIV><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN">You might also try using the </SPAN><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN">PersistenceManager.ForceIdFixUp() to resolve both parent and child tables’ IDs/keys first in an atemmpt to improve the behavior of the reverse topological sort.</SPAN></DIV><DIV><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN"></SPAN>&nbsp;</DIV><DIV><SPAN lang=EN style="FONT-SIZE: 10pt; COLOR: blue; FONT-FAMILY: Arial; mso-ansi-: EN">There are some rare cases where you cannot solve the problem through Persistence Order.&nbsp; In these cases, you will have to solve the problem by performing a 2-step save.</SPAN></DIV>]]>
   </description>
   <pubDate>Wed, 10 Oct 2007 11:30:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1537#1537</guid>
  </item> 
  <item>
   <title>Persistence of entities : I observed what appears strange...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1501#1501</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=52" rel="nofollow">Yaron</a><br /><strong>Subject:</strong> 482<br /><strong>Posted:</strong> 09-Oct-2007 at 9:56am<br /><br /><P>I observed what appears strange behaviour.</P><DIV>I have a simple invoice &amp; stock inventory system, Generate invoice and when saving invoice details - adjust the Qty In stock for the store,</DIV><DIV>what I noticed is that the Invoice Data (rowstate = 'Added') saves fine,but the ProductStore entity (where I store the qty is stock) which has RowState = 'Modified' looses the changes before saving.</DIV><DIV>I used the PM.SaveChanges method.</DIV><DIV>&nbsp;</DIV><DIV>however is I 'split' the save operation i.e. save the StockLevels (modified) rows first, and on a second save operation save the Invoice Details. all works well, here is what I mean</DIV><DIV>&nbsp;&nbsp; </DIV><DIV>Scenario 1 : SaveData(AllChanges) don't work</DIV><DIV>Scenario 2 : SaveData(InvoiceData)</DIV><DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveData(StockLevels) don't work</DIV><DIV>Scenario 3:&nbsp; SaveData(StockLevels)<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SaveData(InvoiceData) works well</DIV><DIV>&nbsp;</DIV><DIV>Can anybody help?</DIV></DIV>]]>
   </description>
   <pubDate>Tue, 09 Oct 2007 09:56:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=482&amp;PID=1501#1501</guid>
  </item> 
 </channel>
</rss>