3个表之间的Hibernate映射

3个表之间的Hibernate映射,hibernate,mapping,Hibernate,Mapping,我需要实体映射方面的帮助,其中涉及3个表 table 1: table name: emp:- col 1: Id, col 2: name table 2: table name: empAddr:- col 1: Id, col 2: empId, col 3: addrId table 3: table name: addr:- col 1: Id, col 2: addrLine 对于上面的每个表,我有3个实体类。 有人能帮我做一下我需要使用的映射吗 emp对empAddr是1对

我需要实体映射方面的帮助,其中涉及3个表

table 1: 
table name: emp:- col 1: Id, col 2: name

table 2:
table name: empAddr:- col 1: Id, col 2: empId, col 3: addrId

table 3:
table name: addr:- col 1: Id, col 2: addrLine
对于上面的每个表,我有3个实体类。 有人能帮我做一下我需要使用的映射吗

emp对empAddr是1对多

在java类中,empAddr到addr是1:1

table1 will have set<table2> tr2;
table2 will have set<table3> tr3; 
表1将设置tr2;
表2将设置tr3;
在xml文件中

  <set name="tr2" table="table2" inverse="true" cascade="save-update" lazy="false" fetch="select">
            <key>
                <column name="empId" length="20" not-null="true" />
            </key>
            <one-to-many class="table1" />
        </set>