not-null error after updating nhibernate from 3.x to 4.0.4.4000

21 views
Skip to first unread message

Florian Endres

unread,
Nov 28, 2016, 6:08:38 AM11/28/16
to nhibernate-development
Hi at all,

after i updated the nhibernate version from 3. x to 4.0.4.4000 in my .NET solution i get now an error while session.Save(documentdata)

not-null property references a null or transient value ProcessControlService.Domain.Entities.DocumentData._ProcessControlService.Domain.Entities.Process.DocumentDataSetBackref

my mapping looks like this

DocumentData:
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ProcessControlService.Domain" namespace="ProcessControlService.Domain.Entities">   <class name="DocumentData" table="DocumentData" lazy="true">     <id name="ID" unsaved-value ="0" type="Int32">       <generator class="native" />     </id>     <property name="BarCode" length="255" not-null="false"/>     <!--<property name="ScanDate" length="50" not-null="false" />-->     <property name="Tiff" length="255" not-null="false" />     <property name="UserID" length="50" not-null="false" />     <property name="InputType" length="100" not-null="false" />     <property name="DocumentImage" length="255" not-null="false" />     <property name="Stack" length="255" not-null="false" />     <many-to-one name="Process" class="Process" column="ProcessID" not-null="true"/>     <property name="DeleteFlag" type="boolean" not-null="true" />     <property name="CompleteFlag" type="boolean" not-null="true" />     <property name="LastWrittenModul" length="50" not-null="false" />         <property name="DateCreated" type="datetime" not-null="true" />     <property name="DateModified" type="datetime" not-null="false" />     <set name ="ModulDataSet" fetch="subselect" cascade="all-delete-orphan">       <key column="DocID" foreign-key="FK_DocumentData_ModulDataList" not-null="true" />       <one-to-many class="ModulData"/>     </set>     <set name ="CommentDataSet" fetch="subselect" cascade="all-delete-orphan">       <key column="DocID" foreign-key="FK_DocumentData_CommentDataList" not-null="true" />       <one-to-many class="CommentData"/>     </set>   </class> </hibernate-mapping>


Process:
<?xml version="1.0" encoding="utf-8" ?> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="ProcessControlService.Domain" namespace="ProcessControlService.Domain.Entities">   <class name="Process" table="Process" lazy="true">     <id name="ID" type="Int32" unsaved-value="0">       <generator class="native" />     </id>     <property name="Name" length="50" not-null="true"  unique-key="UK_Process_Name" />     <property name="Description" length="50" not-null="false" />     <property name="Category" length="10" not-null="true" />     <property name="DateCreated" type="datetime" not-null="true" />     <property name="DateModified" type="datetime" not-null="false" />     <set name ="ModulAssignmentSet" fetch="subselect" cascade="all-delete-orphan">       <key column="ProcessID" foreign-key="FK_Process_ModulAssignmentList" not-null="true" />       <one-to-many class="ProcessModulAssignment"/>     </set>     <set name ="DocumentDataSet" fetch="subselect" inverse="true" cascade="all-delete-orphan">       <key column="ProcessID" foreign-key="FK_Process_DocumentDataList" not-null="true" />       <one-to-many class="DocumentData"/>     </set>        </class> </hibernate-mapping>


IMHO i think it's caused by the many-to-one from DocumentData to Process but even when i comment the many-to-one relationsship the error appears.


Would be great i someone could help me.


greetings

Oskar Berggren

unread,
Nov 28, 2016, 7:12:22 AM11/28/16
to nhibernate-...@googlegroups.com
Hi,

Please format your XML with line-breaks and indenting when you expect others to read it.

That said, I can't think of anything directly. Can you try to recreate the issue as a limited and self-contained test case that we can use to debug?

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

Ricardo Peres

unread,
Nov 28, 2016, 9:18:44 AM11/28/16
to nhibernate-development
The proper place to discuss this is nhusers, not nhibernate-development.
That being said, make sure you rebuild your assembly explicitly when you change the .hbm.xml mappings, because Visual Studio does not know automatically. That may not be related, though.

RP

Ricardo Peres

unread,
Nov 28, 2016, 9:19:35 AM11/28/16
to nhibernate-development
...if, of course, your .hbm.xml files are being included as embedded resources. If that's not the case, please ignore me.

RP
Reply all
Reply to author
Forward
0 new messages