Reputation: 1874
I have mapping
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="DatabaseAccess" namespace="DatabaseAccess.poco">
<class name="Employee" table="emplyees" lazy="true">
<id name="id">
<generator class="increment"></generator>
</id>
<property name="first_name" not-null="true"></property>
<property name="last_name" not-null="true"></property>
<property name="login" not-null="true"></property>
<property name="sid"></property>
</class>
</hibernate-mapping>
What I can do if session.Save(object) do not throw exception:
not-null property references a null or transient value
I want to fill these nulls before commit anyway.
Upvotes: 1
Views: 6644
Reputation: 150263
What I can do if session.Save(object) do not throw exception: not-null property references a null or transient value I want to fill these nulls before commit anyway.
session.Save(obj);
obj.Foo = new foo();
//session.SaveOrUpdate(object) // required if it's a new session.
Upvotes: 1