<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
 <hibernate-mapping>
  <!-- User实体对象 -->  
     <class name="user.User"  table="tab_user">
   <!-- 主键id -->  
    <id name="id">
       <generator class="native"/>
    </id> 
    <!-- 用户名称--> 
     <property name="name" not-null="true"/>
     <set name="roles" table="tab_mapping"
       <!-- 映射地字段--> 
         <key column="user_id"></key>
          <!-- 权限地映射表--> 
    <many-to-many class="role.Role" column="role_id"/>
    </set>
     </class>
 </hibernate-mapping>