hibernate复合主键

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping package="cn.itcast.d_compositeKey" auto-import="true">
    <class name="User">
        <!-- 复合主键映射 -->
        <composite-id name="keys">
            <key-property name="userName" type="string"></key-property>
            <key-property name="address" type="string"></key-property>
        </composite-id>
        <property name="age" type="int"></property>        
    </class>
</hibernate-mapping>

 

posted @ 2017-12-27 15:19  aLa神灯  阅读(127)  评论(0编辑  收藏  举报