多表的建立 (一) DataZJ表的類和映射
1
using System;
2
using System.Collections;
3
using Iesi.Collections;
4![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
namespace temp0704
6
{
7
#region DataZJ
8![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
/// <summary>
10
/// DataZJ object for NHibernate mapped table 'DataZJ'.
11
/// </summary>
12
public class DataZJ
13
{
14
#region Member Variables
15![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
protected int _id;
17
protected long _xb;
18
protected DateTime _sr;
19
protected string _dz;
20
private ISet _user;
21![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
#endregion
23![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
24
#region Constructors
25![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
26
public DataZJ ( ) { }
27![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
28
public DataZJ ( long xb, DateTime sr, string dz )
29
{
30
this._xb = xb;
31
this._sr = sr;
32
this._dz = dz;
33
}
34![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
35
#endregion
36![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
37
#region Public Properties
38
///這個地方對應了一個映射了,注意要寫成Iset類型,因為映射里面使用set標簽
39
public virtual ISet USZJ
40
{
41
get
42
{
43
return _user;
44
}set
45
{
46
_user = value;
47
}
48
}
49
public virtual int Id
50
{
51
get { return _id; }
52
set { _id = value; }
53
}
54![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
55
public virtual long Xb
56
{
57
get { return _xb; }
58
set { _xb = value; }
59
}
60![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
61
public virtual DateTime Sr
62
{
63
get { return _sr; }
64
set { _sr = value; }
65
}
66![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
67
public virtual string Dz
68
{
69
get { return _dz; }
70
set
71
{
72
if ( value != null && value.Length > 500 )
73
throw new ArgumentOutOfRangeException("Invalid value for Dz", value, value.ToString());
74
_dz = value;
75
}
76
}
77![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
78![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
79![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
80
#endregion
81
}
82
#endregion
83
}
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
24
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
25
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
26
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
27
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
28
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
29
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
30
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
31
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
32
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
33
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
34
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
35
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
36
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
37
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
38
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
39
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
40
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
41
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
42
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
43
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
44
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
45
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
46
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
47
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
48
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
49
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
50
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
51
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
52
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
53
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
54
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
55
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
56
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
57
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
58
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
59
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
60
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
61
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
62
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
63
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
64
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
65
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
66
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
67
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
68
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
69
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
70
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
71
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
72
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
73
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
74
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
75
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
76
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
77
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
78
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
79
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
80
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
81
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
82
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
83
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
1
<?xml version="1.0" encoding="utf-8" ?>
2
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
3
<class name="temp0704.DataZJ, temp0704" table="DataZJ">
4
<id name="Id" type="Int32" unsaved-value="null">
5
<column name="Meid" length="4" sql-type="int" not-null="true" unique="true" index="PK_DataZJ"/>
6
<generator class="native" />
7
</id>
8
<property name="Xb" type="Int64">
9
<column name="xb" length="8" sql-type="bigint" not-null="false"/>
10
</property>
11
<property name="Sr" type="DateTime">
12
<column name="sr" length="8" sql-type="datetime" not-null="false"/>
13
</property>
14
<property name="Dz" type="String">
15
<column name="dz" length="500" sql-type="varchar" not-null="false"/>
16
</property>
17
<set name="USZJ" table="UserZJ" lazy="true">
18
<key column="Meid"/>
19
<one-to-many class="temp0704.UserZJ, temp0704" not-found="ignore" />
20
</set>
21
</class>
22
</hibernate-mapping>
23![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
2
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
3
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
5
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
6
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
7
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
8
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
9
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
10
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
11
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
12
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
13
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
14
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
17
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
18
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
19
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
20
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
21
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
22
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
23
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
映射的寫法
<set name="USZJ" table="UserZJ" lazy="true">
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
</set>