c# - NHibernate - one to one mapping of foreign key -


i have excluded many sections brevity.

i have 2 classes, map 2 tables in database. speedscript , adminuser. speedscript has foreign key of adminuserid. have created one-to-one mapping works when retrieve instance of speedscript using nhibernate , admin user property correctly loaded. here's mapping

<class name="speedscript" table="speedscript" lazy="false"> <id name="speedscriptid">   <column name="speedscriptid" />   <generator class="native" />   </id> <property name="scriptname">   <column name="name" /> </property> <one-to-one name="adminuser" class="adminuser" cascade="all" lazy="false" /> 

<class name="adminuser" table="adminuser" lazy="false">     <id name="adminuserid">       <column name="adminuserid" />       <generator class="native" />     </id>     <property name="name">       <column name="name" />     </property>   </class>  

i change adminuser property different. commit database follows:

      private void savespeedscripttodatabase(speedscript speedscript) {     isession session = nhibernatehelper.getcurrentsession();     using (session.begintransaction())     {         session.saveorupdate(speedscript);         session.transaction.commit();     }     session.dispose(); } 

unfortunately have no idea why adminuserid column not updated. have searched endlessly through stack overflow , can't find answer.

any appreciated.


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -