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
|
I just rewatched the eager loading screen cast and believe I was mistaken on eager loading. According to the video when eager load is set to true all entities from the table are returned. I had thought that eager loading only returned the children of the entities requested. Resulting Query Examples Select * from MTypes where type = 'TS' MSize is a child relation to MType With eager load true on MSize, would this be the query? Select * from MSize What I thought was after running the above MType query with lightspeed that the Eager load query would be something like Select * from MSize WHERE EXISTS(Select * from Mtypes where MType.type = 'TS' and MType.Id = MSize.MTypeId)
I am pretty sure this is not how eager loading works now. Is there any future for this type of eager loading (where only the children of queries are eager loaded)? |
|
|
You are correct in your current understanding of eager loading. Eager loading loads only associated entities, NOT all entities from the associated table. Consider a Customer with an eager-loaded Orders collection, and suppose you load all Customers named 'Bob'. This will result in the following query: SELECT ... FROM Customer WHERE Customer.FirstName = 'Bob'; SELECT ... FROM Order WHERE EXISTS (The exact SQL emitted will vary from database to database. You can verify the actual SQL using the LightSpeedContext.Logger.) Thus, if all the customers named 'Bob' have only 3 orders between them, only 3 orders will be selected from the database, not all orders in the database. It sounds like the screencast may be a little unclear or misleading. I think the video probably meant to imply "all *relevant* entities" rather than "*all* entities in the table." Eager loading loads only the required children and this is how it will continue to work in the future. |
|
|
Thanks for clearing things up |
|