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
|
Hi, I got this error, "The objects "Country" and "Country" in the FROM clause have the same exposed names. Use correlation names to distinguish them." Here's the code: Query query = new Query();
LS generated wrong query:
SELECT |
|
|
Thanks for reporting this issue. I've committed a candidate fix and it will be in nightly builds dated 19 Aug 2009 and above, available from about 1430 GMT. Please let us know if you still see problems. |
|
|
Thanks for the fixed Ivan. It works fine now. But I'm wondering what is the sense of having two Country table in join. SELECT |
|
|
For your specific scenario, there is no need to join twice to the Country table because it is the same join each time. But in the more general case this might be required. Imagine a Shipment entity that has two associations to the Country type, ImportingCountry and ExportingCountry, and now consider the following ordering: Order.By("ImportingCountry.Name").AndBy("ExportingCountry.Name") If we did a single join then we would have to pick either ImportingCountryId or ExportingCountryId to join on, and the other one would effective get its ordering ignored: SELECT So in general we need to do two separate joins: INNER JOIN And for the time being we have not attempted to optimise this away for the "multiple traversals of the same association" case. Hope this clarifies the behaviour! |
|
|
Thanks Ivan!
|
|