Thanks for your adding strength to the solution determined. Its lot of good learning by participating in WO Community mailing lists.
Cheers, Shravan Kumar. M ________________________________ From: Mike Schrag <[email protected]> To: Shravan Kumar. M <[email protected]> Cc: Kieran Kelleher <[email protected]>; WO Dev Group <[email protected]> Sent: Sun, November 1, 2009 6:39:32 PM Subject: Re: [SOLVED] how to insert records in database in the order of insertion to EC 100% with chuck here ... the database is an unordered set. don't depend on this. don't play pk tricks. if you want a specific order, add a field that represents this specific order and sort by it on fetch. clearly order "matters" to you, which means that ordering is "real data" and should be represented in your db explicitly, not achieved with trickery. On Nov 1, 2009, at 7:40 AM, Shravan Kumar. M wrote: Thanks Kieran for your solution. But unfortunately, we don't extend ERXGenericRecord, so we cannot get benefits of this!!! I have actually read about your this solution in a similar kind of issue posted and responded by you here: http://www.mail-archive.com/[email protected]/msg25975.html > > > > ________________________________ From: Kieran Kelleher <[email protected]> >To: Shravan Kumar. M <[email protected]> >Cc: Chuck Hill <[email protected]>; WO Dev Group ><[email protected]> >Sent: Sun, November 1, 2009 5:55:25 PM >Subject: Re: how to insert records in database in the order of insertion to EC > >Or if you want the order of the PKs to be the same order as your insertion >into the EC, you can try calling > > >eo.primaryKeyInTransaction (or sth like that) > > >which is provided by ERXGenericRecord subclass. > > >That method assigned the PK ....... do it in each iteration. Then the items >are saved the the PK order the same as insertion order. > > >Regards, Kieran > > >On Nov 1, 2009, at 12:11 AM, Shravan Kumar. M wrote: > >Okay. So, as determined I will just with adding a new field to set the order >of records inserted to DB. >> >>Thanks again Chuck for your insight!!! >> >> >> >> ________________________________ From: Chuck Hill <[email protected]> >>To: Shravan Kumar. M <[email protected]> >>Cc: WO Dev Group <[email protected]> >>Sent: Sun, November 1, 2009 9:34:31 AM >>Subject: Re: how to insert records in database in the order of insertion to EC >> >> >>On Oct 31, 2009, at 8:46 PM, Shravan Kumar. M wrote: >> >>> Thanks so much for your quick response Chuck. >>> >>> We use Frontbase. I have no FK issue here. It's just that the objects >>> should be inserted to DB in the order I have created and inserted into EC. >>> >>> Why EC saveChanges() operation just not save the objects in the order of >>> insertion??? Isn't it simple? I believe EC maintains an array >>> insertedObjects(), so it should just follow that array order, unless >>> otherwise any constraints as you have mentioned!!! Just trying to >>> understand the mystery behind the complexity :) >> >>For what you want, it would not matter if it did. The defined order of >>records in an un-ordered Select (a select with no Order By clause) is >>indeterminate. The database is free to change the order of such result sets >>to return the result set in the shortest amount of time or any other reason >>it might have. >> >> >>> If there's no built-in solution, then probably adding a "sortOrder" field >>> to my table would fix this issue. >> >>That is the ONLY solution you can depend on. >> >> >>Chuck >> >> >>> From: Chuck Hill <[email protected]> >>> To: Shravan Kumar. M <[email protected]> >>> Cc: WO Dev Group <[email protected]> >>> Sent: Sun, November 1, 2009 8:49:54 AM >>> Subject: Re: how to insert records in database in the order of insertion to >>> EC >>> >>> >>> On Oct 31, 2009, at 6:57 PM, Shravan Kumar. M wrote: >>> >>> > Hi Group, >>> > >>> > Could any one please advise me how can I insert records in database in a >>> > specific order or as per the order of insertion of objects to >>> > EditingContext >>> >>> AFAIK, you can't. The order of insertion is not tracked. >>> >>> >>> > for eg: >>> > >>> > I have inserted objects to EC in the following order: A1, A2, A3, A4, A5 >>> > (and then saved the EC once - editingContext.saveChanges()) >>> > But, when these got saved to database the order is disturbed and is not >>> > guaranteed i.e., I see following order sometimes: A2, A5, A1, A3, A4, >>> > whereas I want the order of these objects as I have inserted to EC. >>> > >>> > I heard that we can do something with AdaptorOperations, but not sure of >>> > that exactly and am trying to see if we have an higher level API for >>> > that. (Just a note: We do not use Wonder to the fullest, of course we use >>> > Wonder API's as required.) >>> >>> >>> If your problem is FK constraint violations, make the constraints >>> DEFERRABLE INITIALLY DEFERRED when you create them. >>> >>> If you are using MS SQL Server, then you are in a world of hurt. It >>> includes not supporting deferrable constraints in its set of unsupported >>> yet highly desirable features. There is a reason why people mock that >>> "database". You can order the operations using EOF but (a) is isn't easy >>> and (b) you can't expect to know the order of insertion and (c) I can't >>> think of many useful examples to follow. You could start with the source >>> for myhttp://www.global-village.net/chill/ms_sql_server_eof_plugin >>> >>> >>> Chuck >>> >>> --Chuck Hill Senior Consultant / VP Development >>> >>> Practical WebObjects - for developers who want to increase their overall >>> knowledge of WebObjects or who are trying to solve specific problems. >>> http://www.global-village.net/products/practical_webobjects >>> >>> >>> >>> >>> >>> >>> >>> >>> >> >>--Chuck Hill Senior Consultant / VP Development >> >>Practical WebObjects - for developers who want to increase their overall >>knowledge of WebObjects or who are trying to solve specific problems. >>http://www.global-village.net/products/practical_webobjects >> >> >> >> >> >> >> >> >>_______________________________________________ >>Do not post admin requests to the list. They will be ignored. >>Webobjects-dev mailing list ([email protected]) >>Help/Unsubscribe/Update your Subscription: >>http://lists.apple.com/mailman/options/webobjects-dev/kieran_lists%40mac.com >> >>This email sent to [email protected] > >_______________________________________________ >Do not post admin requests to the list. They will be ignored. >Webobjects-dev mailing list ([email protected]) >Help/Unsubscribe/Update your Subscription: >http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40mdimension.com > >This email sent to [email protected]
_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
