HIBERNATE的配置

关于HIBERNATE中.hbm.xml的配置的说明:

<!--
文件的头部分,..........
-->

<class name="com.zhenjw.role" table="role">
    <id name="no"  type="java.lang.Long">
        <column name="ROLENO" precision="22"  scale="2" />
        <generator class="sequence">
            <param name="sequence">role_seq</param>
        </generator>
    </id>

    <set name="userinfos"  inverse="true" >
         <key>
            <!--外键-->
            <column name="roleno"        pricision="22"  scale="0"  />
         </key> 
         <one-to-many  class="com.zhenjw.Userinfo"  />
    </set>
</class>





.............
   <class name="com.zhenjw.Userinfo" table="userinfo" >
            <id name="userno" type="java.lang.Long" />
            </id>
           <many-to-one  name="role"  class="com.zhenjw.Role" fetch="select">
               <!--外键-->
               <column name="roleno" />

           </many-to-one>
             
    </class>






你可能感兴趣的:(java,Hibernate,xml)