Re: how to insert records in database in the order of insertion to EC
Re: how to insert records in database in the order of insertion to EC
- Subject: Re: how to insert records in database in the order of insertion to EC
- From: Chuck Hill <email@hidden>
- Date: Sat, 31 Oct 2009 20:19:54 -0700
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 my http://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
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden