我有3节课。
BusinessStream
Scheme
Bus_Stream_Scheme_Map
当我尝试执行transaction.Commit()
方法时,在session.SaveOrUpdate()
BusinessStream
之后,我收到以下错误,
无法插入NULL(“DBO”。“BUS_STREAM_SCHEME_MAP”。“BUS_STREAM_SCHEME_MAP_ID”)
HBM档案,
BusienssStream
<class name="BusinessStream" table="BUS_STREAM">
<id name="Id" column="BS_ID" type="Int32" >
<generator class="sequence">
<param name="sequence">BUS_STREAM_SEQ</param>
</generator>
</id>
<property name="Name" column="Name" type="String"/>
<property name="Description" column="Description" type="String"/>
<bag name="Schemes" table="BUS_STREAM_SCHEME_MAP" lazy="false">
<key column="BUS_STREAM_ID"></key>
<many-to-many class="Scheme" column="SCHEME_ID"></many-to-many>
</bag>
</class>
方案
<class name="Scheme" table="SCHEME_DEF">
<id name="Id">
<column name="SCHEME_ID"/>
<generator class="native">
<param name="sequence">SCHEME_DEF_SEQ</param>
</generator>
</id>
<property name="Description" column="SCHEME_DESC" type="String"/>
</class>
BusinessStream_Scheme_Map
<class name="BusinessStreamSchemeMapping" table="BUS_STREAM_SCHEME_MAP">
<id name="Id">
<column name="BUS_STREAM_SCHEME_MAP_ID"/>
<generator class="native">
<param name="sequence">BUS_STREAM_SCHEME_MAP_SEQ</param>
</generator>
</id>
</class>
我做错了什么?
答案 0 :(得分:0)
这只是猜测,但是如果将BUS_STREAM_SCHEME_MAP_ID
设置为自动递增字段,它会起作用吗?