1。在插入Blacklist对象的时候报错。
2。我尝试着删除<many-to-one ...>的两端配置节(代码中灰化部分)之后添加成功,但是在查询出来的Blacklist对象中的关联的父对象都为空。
3。以下是Blacklist映射的配置表。这个问题困扰我好久,希望有人帮我解决一下,谢谢!
1 <?xml version='1.0' encoding='utf-8' ?>
2 <hibernate-mapping xmlns='urn:nhibernate-mapping-2.2'
3 assembly='Model'
4 namespace='Model'
5 >
6 <class name='Blacklist'
7 table='`Blacklist`'
8 >
9 <id name='Id'
10 column='`Id`'
11 >
12 <generator class='native'>
13 </generator>
14 </id>
15 <property name='Number'
16 column='`Number`'
17 />
18 <property name='SearchCount'
19 column='`SearchCount`'
20 />
21 <property name='ReportCount'
22 column='`ReportCount`'
23 />
24 <property name='AccusedCityId'
25 column='`AccusedCityId`'
26 />
27 <property name='AssuedIp'
28 column='`AssuedIp`'
29 />
30 <property name='AssuedName'
31 column='`AssuedName`'
32 />
33 <property name='UserId'
34 column='`UserId`'
35 />
36 <property name='ReportTime'
37 column='ReportTime'
38 />
39 <bag name='BlacklistRelationFastGroups' cascade='all' inverse='false'>
40 <key column='`BlacklistId`' />
41 <one-to-many class='BlacklistRelationFastGroup' />
42 </bag>
43
44 <bag name='BlacklistRelationFeatures' cascade='all' inverse='false'>
45 <key column='`BlacklistId`' />
46 <one-to-many class='BlacklistRelationFeature' />
47 </bag>
48
49 <bag name='Indicatives' cascade='all' inverse='false'>
50 <key column='`BlackId`' />
51 <one-to-many class='Indicative'/>
52
53 </bag>
54 <many-to-one name='User' class='Users' column='`UserId`' />
55 <many-to-one name='AccusedCity' class='Region' column='`AccusedCityId`'/>
56 </class>
57 </hibernate-mapping>
Blacklist 和 Many-To-one 即Uesr AccusedCity有双向关联吗?
原因是从表关联主表时的问题.:
<many-to-one name="dictate" column="DICTATEID" class="Model.JkptOaxtDictate,Model"/>
即添加属性insert="false" update="false"
我也遇到此问题,回答一下,方便后来人看。
你发的链接已经打不开了。
有点用处,2个相同column导致,如果没关联上另一个模型至少还会出来一个Orderformid1
<property name="Orderformid1" column="ORDERFORMID" type="String" />
<many-to-one name="Orderformid" column="ORDERFORMID"
class="Model.Orderform"
not-found="ignore" insert="false" update="false">
</many-to-one>