In fact, there is no need to map intermediate tables in part of the time, it seems a lot more, but hibernate also supports this operation, the specific one-way N: 1. If no intermediate table ing exists, refer to mappings.
Now only the changed parts are posted.
<? XML version = "1.0" encoding = "UTF-8" ?> <! Doctype hibernate-mapping public "-// hibernate/hibernate mapping DTD 3.0 //" http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd" > < Hibernate-Mapping > < Class Name = "Com. longtech. hibernate. domain. Employee" Table = "Employee" > < ID Name = "ID" Column = "ID" Type = "Java. Lang. Long" > < Meta Attribute = "Field-description" > Unique Identifier </ Meta > < Generator Class = "Native" /> </ ID > < Property Name = "Name" Type = "Java. Lang. String" Column = "Name" Length = "20" > < Meta Attribute = "Field-description" > Employee name </ Meta > </ Property > <! -- <Role-to-one name = "department" column = "dept_id" cascade = "all"> </role-to-one> --> < Join Table = "Maid" > < Key Column = "Empid" > </ Key > < Allow-to-one Name = "Department" Cascade = "All" Column = "Deptid" > </ Allow-to-one > </ Join > </ Class > </ Hibernate-Mapping >
The changed part adds a join label. When using join, an intermediate table is usually specified.
At the database level, it will have an additional intermediate table