Hello Everyone,
I have two tables something like this :
Table : Account
AccountID
UserName
Password
Table : Address
AddressID
AccountID
Line1
Line2
State
My NHibernate mapping file looks like this :
For Table Account
<id name="ID" type="long" column="AccountID" access="property">
<generator class="identity"/>
</id>
<property name="Username" column="Username" type="String" />
<property name="Password" column="Password" type="String" />
For Table : Address
<id name="ID" type="long" column="AddressID" access="property">
<generator class="identity"/>
</id>
<many-to-one name="Account" column="AccountID" class="..., ...." fetch="select"/>
<property name="Line1" column="Line1" type="String" />
<property name="Line2" column="Line2" type="String" />
My Problem is it does entry in the Account table perfectly, but when it comes to do entry in Address Table it says AccountID can't be null, I'm wondering shouldn't it pick it up from the Account table as I'm passing in that object.
Please advise how to fix it.
|