The problem in your code is that you're projecting the integer ID into a
non nullable ID on the other side. If you make it nullable it will work.
The error message is not very nice, admittedly, but it's correct behavior
that is fails. Falling back to default(T) would result in misrepresentative
data.

/G

2015-05-08 17:33 GMT+02:00 <triadse...@gmail.com>:

> Find the example attached. Happens at least with NHibernate 4.0.3GA and
> apparently also with current master.
>
> On Wednesday, May 6, 2015 at 8:49:20 PM UTC+2, Oskar Berggren wrote:
>
>>
>>
>> 2015-05-06 18:42 GMT+01:00 <triad...@gmail.com>:
>>
>>> Well in my post, that's the code.
>>>
>>>
>> Mappings etc? Can you wrap it up as a self-contained unit test?
>>
>>
>> I have a bunch of code that looks similar. This is the example I could
>> find quickly.
>>
>> attribute => new AttributeValueRecord
>>             {
>>                 ConnectionId = attribute.DBConnection.Id,
>>
>>
>> Where DBConnection is actually NULL for most records in the database, and
>> it works fine.
>>
>> Judging from the names of your parameters, one difference is that in the
>> example I could find quickly, I'm only accessing the primary key of the
>> referenced object. You can check if that makes a difference (won't solve
>> your issue, of course, but would be interesting to know).
>>
>> Another thing is are you really sure that the exception is generated from
>> inside the compiled expression? Or might it be somewhere else?
>>
>> What NHibernate version is this?
>>
>> /Oskar
>>
>>
>>  --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "nhibernate-development" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nhibernate-development+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"nhibernate-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to nhibernate-development+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to