This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
Wha is LightSpeeds strategy for determining the order of SQL inserts, updates and deletes? Specifically I would like to know that if I were to add 5 entity objects to a unit of work would they be saved into the database in the same order that they were added? How would the order be affected if the unit of work also contained deleted and or edited objects?
|
|
|
No, we do NOT guarantee that your five entities will be saved in the order they were added to the unit of work. The ordering of operations is based on the associations between entities: if Entity Type A has a foreign key to Entity Type B then Bs will be inserted before As and As will be deleted before Bs. All inserts and updates happen first (in 'association order'), then all deletes (in 'reverse association order'). Within an entity type, operations could happen in any order (e.g. we do not guarantee whether B1 or B2 will be inserted first). The exception is if an entity type has an association (foreign key) to self, in which case we analyse for dependencies and order accordingly. |
|