I hope someone is still tracking this thread. I'm using NH 3.3.1. I have
a one-to-many mapping where inverse="false" and the FK column is not
nullable (legacy DB, nothing I can do), but when I add an item to the
collection and commit my transaction I still get the "cannot insert..."
error because it's trying to insert a record with a null FK. Is there
something special I should be doing in the mapping to tell NH to put the
parent's PK into the child's FK on the insert? Here's the relevant part of
the mapping:
<set name="companyAddressTbs" cascade="all" generic="true">
<key>
<column name="COMPANY_ID" not-null="true" />
</key>
<one-to-many class="CompanyAddressTb" />
</set>
On Monday, August 6, 2012 5:10:04 PM UTC+3, Alexander I. Zaytsev wrote:
>
> Hi, all
>
> As you may know NH since 3.2 supports uni-directional one-to-many
> associations.
>
> This was done by these commits
>
>
> https://github.com/nhibernate/nhibernate-core/commit/cb60f2169e7504ff83e601c555e42171f28ef9ff
>
>
>
> https://github.com/nhibernate/nhibernate-core/commit/d6cc06bbfee56fc3ae224fdfdc862df4fdff0442
>
>
> I wonder why this fix is applied only to keys with
> *not-null="true"*attribute? I've checked and it seems that all works
> perfectly without
> checking that key is not nullable.
>
> As I understand the fix was ported from Hibernate, because there I've
> found exactly the same code.
>
--
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.