I find that is generally a good idea to make the relationship inverse.

/G

2014-12-29 8:24 GMT+01:00 Alexey Pelykh <[email protected]>:

> I'm experiencing very same issue, but with NH 4. How did you overcome it?
>
>
> On Wednesday, August 7, 2013 9:19:18 AM UTC+3, [email protected] wrote:
>>
>> I had already posted a reply a few days ago, but it seems, that it didn't
>> work.
>>
>> The generated mappings from fluent are identical, the behavior changed
>> from nhibernate version 3.1 to 3.2
>>
>> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
>>   <class xmlns="urn:nhibernate-mapping-2.2" name="ConsoleApplication4.User,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> table="`User`">
>>     <id name="Id" type="System.Guid, mscorlib, Version=4.0.0.0,
>> Culture=neutral, PublicKeyToken=b77a5c561934e089" unsaved-value=
>> "00000000-0000-0000-0000-000000000000">
>>       <column name="Id" />
>>       <generator class="guid.comb" />
>>     </id>
>>     <bag cascade="save-update" name="Roles">
>>       <key not-null="true">
>>         <column name="User_id" />
>>       </key>
>>       <one-to-many class="ConsoleApplication4.RoleUser,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> />
>>     </bag>
>>     <property name="Username" type="System.String, mscorlib,
>> Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
>>       <column name="Username" length="20" not-null="true" />
>>     </property>
>>   </class>
>> </hibernate-mapping>
>>
>> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
>>   <class xmlns="urn:nhibernate-mapping-2.2" 
>> name="ConsoleApplication4.RoleUser,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> table="RoleToUser">
>>     <id name="Id" type="System.Guid, mscorlib, Version=4.0.0.0,
>> Culture=neutral, PublicKeyToken=b77a5c561934e089" unsaved-value=
>> "00000000-0000-0000-0000-000000000000">
>>       <column name="Id" />
>>       <generator class="guid.comb" />
>>     </id>
>>     <many-to-one cascade="none" class="ConsoleApplication4.User,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> name="User">
>>       <column name="User_id" not-null="true" />
>>     </many-to-one>
>>     <many-to-one cascade="none" class="ConsoleApplication4.Role,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> name="Role">
>>       <column name="Role_id" not-null="true" />
>>     </many-to-one>
>>   </class>
>> </hibernate-mapping>
>>
>> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
>>   <class xmlns="urn:nhibernate-mapping-2.2" name="ConsoleApplication4.Role,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> table="`Role`">
>>     <id name="Id" type="System.Guid, mscorlib, Version=4.0.0.0,
>> Culture=neutral, PublicKeyToken=b77a5c561934e089" unsaved-value=
>> "00000000-0000-0000-0000-000000000000">
>>       <column name="Id" />
>>       <generator class="guid.comb" />
>>     </id>
>>     <bag cascade="save-update" name="Users">
>>       <key not-null="true">
>>         <column name="Role_id" />
>>       </key>
>>       <one-to-many class="ConsoleApplication4.RoleUser,
>> ConsoleApplication4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"
>> />
>>     </bag>
>>     <property name="Name" type="System.String, mscorlib,
>> Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
>>       <column name="Name" length="32" not-null="true" />
>>     </property>
>>   </class>
>> </hibernate-mapping>
>>
>>  --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to