I've been struggling with this for a few days, and I'm ready to throw myself at the community's mercy :)
Ultimately what I'm trying to do is work around AR and NH's lack of support for SQL 2008's geography data type. I'm writing an app that does a bunch of location-based comparisons, and I want to take advantage of the spatial indexing available when using this column. I spent about 2 days using NHibernate.Spatial's experimental support for the geography type, but the results I received didn't appear to be correct. I was expecting to receive distances in meters (which I could convert as desired to other units of measurement), but what was returned was not anywhere close to the values I was getting through direct querying of the database. I'd read somewhere that the results wouldn't be returned in meters, but rather in the same units as the comparable calculation for the geometry type. So I gave up on that path. I've spent a day trying to hide the mechanics through SQL functions, but the only way to avoid taking a beating on performance is through a table-valued function, rather than a scalar function applied to each row. So this is where I'm currently stuck. When I try to use native SQL, I get errors like: The multi-part identifier "Location_1_.Code" could not be bound. The multi-part identifier "Location_1_.CountryId" could not be bound. So now I'm trying to use HQL, and I'm having trouble figuring out how to create a mapping in AR similar to how Ayende points out in NH here: http://ayende.com/Blog/archive/2006/10/01/UsingSQLFunctionsInNHibernate.aspx not sure how dated that information is, either, but it seems to be about the most comprehensive guide in this area that I've been able to find. Anyhow, I'll take any advice I can get. I realize I didn't add any code, but if that will help, I can add it in a subsequent post, this one is getting long. If anyone can point me in the right direction, I'd be eternally grateful. Thanks, Jason -- You received this message because you are subscribed to the Google Groups "Castle Project Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/castle-project-users?hl=.
