hi,
I'm getting the following error message when i try to insert a line with Nhibrnate:
Code:
could not synchronize database state with session --> Column 'IP' cannot be nul
I've verified that it's due the attribute which is define as "not null" but has no default values.
What can i do to resolve that ?? hav i to modify my mapping file??
This my mappinf file :
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.0">
<class name="IntMapLib.Interface, IntMapLib" table="Interface">
<id name="Port" column="Port" type="Int32" length="9">
<generator class="assigned" />
</id>
<property name="Subnet" type="Int16" length="6"/>
<property name="Domaine" type="String" length="50"/>
<property name="Dhcp" type="Int16" length="1"/>
<property name="Ip" column= "IP" type="string" length="15"/>
<property name="Portsouverts" type="string" length="255"/>
<property name="Nom" type="String" length="50"/>
<property name="Dnsprimaire" type="String" length="15"/>
<property name="Dnssecondaire" type="String" length="15"/>
<property name="Passerelle" type="String" length="15"/>
<property name="Masque" type="string" length="15"/>
</class>
</hibernate-mapping>
And this is my table :
Code:
+---------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+--------------+------+-----+---------+-------+
| Port | int(9) | | PRI | 0 | |
| IP | varchar(15) | | PRI | | |
| Masque | varchar(15) | YES | | NULL | |
| PortsOuverts | varchar(255) | YES | | NULL | |
| Subnet | smallint(6) | | MUL | -1 | |
| Nom | varchar(50) | YES | | NULL | |
| Domaine | varchar(50) | YES | | NULL | |
| DHCP | tinyint(1) | YES | | 1 | |
| DNSPrimaire | varchar(15) | YES | | NULL | |
| DNSSecondaire | varchar(15) | YES | | NULL | |
| Passerelle | varchar(15) | YES | | NULL | |
+---------------+--------------+------+-----+---------+-------+
thank u in advance