We have tried to upgrade nhibernate to 3.3 but nothing changed, the linq 
query throws the same exception.

Am Mittwoch, 5. Juni 2013 19:49:16 UTC+2 schrieb Oskar Berggren:

> There are been many improvements to linq support in versions after 3.1. 
> You should try with the latest version (3.3.3).
>
> /Oskar
>
>
> 2013/6/5 <[email protected] <javascript:>>
>
>> Hello
>>  
>> We have received an old application to modernize, so we have upgrade 
>> nhibernate to version 3.1 and we have begun to replaced a lot of sql and 
>> hql queries with linq queries but we have a problem with a special mapping. 
>> The mapping is used to map translations of a text, basically you have a 
>> "Text" table and a "Translation" table, the translation table contains the 
>> text table id, the language code and the translated text.
>>  
>> The mapping is done with fluent and it maps the "Translation" table to a 
>> dictionary:
>>  
>> HasMany(x => x.Translations)
>>  .Table("Translation")
>>  .AsMap<int>("LanguageCode")
>>  .Element("Translation")
>>  .KeyColumn("TextId")
>>  .Cascade.AllDeleteOrphan();
>>
>> But if we write linq query to search a translation in the dictionary like 
>> this one:
>>  
>>  Session.Query<Example>().Where(e=>e.Text.Translations.Any(t=>t.Value==
>> "Hello")).ToList();
>>
>> nHibernate throws the following exception: "cannot dereference scalar 
>> collection element: Value"
>>  
>> The hql query that we want to replace with a linq one is like the 
>> following one:
>>  
>> Session.CreateQuery("select e from Example e join e.Text.Translations as 
>> translation where translation=:text").SetParameter("text","Hello").ToList
>> ();
>>
>> Is there a chance to not change the mapping and convert the query from 
>> hql to linq? Or we have to change the mapping and create a "translation" 
>> entity to do it?
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "nhusers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected]<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to