Hi,

I am getting this persistent error that I can't fix:

> PropertyValueException: not-null property references a null or transient 
value 
AstroLab.Research.LearningLab.AstroComet._AstroLab.Research.LearningLab.AstroSystem.CometsBackref

This error happens inside Session.Save. I create a new comet 
programatically, and I am trying to use Session.Save to persist it to the 
database.

Googling the error turns up very little info.  

In the database, the two tables look like this:

```

CREATE TABLE cometList (
[systemID] [int] NOT NULL,
[cometID] [int] IDENTITY(1,1) NOT NULL,
[cometName] [nvarchar](255) NOT NULL,
[cometSequence] [int] NOT NULL,
[isLocal] [bit] NULL
);
CREATE TABLE systemList (
[learningID] [int] NOT NULL,
[systemID] [int] IDENTITY(1,1) NOT NULL,
[systemSequence] [int] NOT NULL,
[systemName] [nvarchar](255) NULL,
[systemDateTime] [datetime2](0) NULL,
);
```

In the cometList table, the systemID column is a foreign key(systemList).

Inside my .NetCore Web App, my AstroComet XML mapping looks like this:


```
<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    schema="dbo" assembly="AstroLab.Learn" 
namespace="AstroLab.Research.LearningLab">
  <class name="AstroComet" table="cometList">
    <id name="Id" column="cometID">
      <generator class="identity" />
    </id>

    <many-to-one name="System" class="AstroSystem" column="systemID" 
update="false" insert="false" />
    <property name="Sequence" column="cometSequence" update="false" 
insert="false" />

    <property name="Title" column="cometName" />

    <property name="IsLocal" column="isLocal"/>

  </class>
</hibernate-mapping>
```

And the AstroSystem mapping looks like this:


```
<?xml version="1.0" encoding="utf-8" ?>

<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
    schema="dbo" assembly="AstroLab.Learn" 
namespace="AstroLab.Research.LearningLab">

  <class name="AstroSystem" table="systemList">
    <id name="Id" column="systemID">
      <generator class="identity" />
    </id>

    <many-to-one name="LearningLab" class="LearningLab" column="learningID" 
insert="false" update="false" />
    <property name="Sequence" column="systemSequence" insert="false" 
update="false"/>

    <property name="Title" column="systemName" />
    <property name="ResearchDate" column="systemDateTime" />


    <list name="Comets" inverse="false" cascade="all">
      <key column="systemID" not-null="true" />
      <index column="cometSequence" />
      <one-to-many class="AstroComet" />
    </list>


  </class>
</hibernate-mapping>
```

I've searched, tried a few things, rewrote some of the code, but it always 
gives me this error no matter how I try to fix it.

If anyone has any experience with an error like this, please let me know.

Thanks!

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/nhusers/b77be577-f377-49a9-adb3-ddf576f133ben%40googlegroups.com.

Reply via email to