Hibernate onetoone配置示例

Hibernate onetoone配置示例 (人和身份证主键单向关联)

 

Person.hbm.xml

 

 

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
 "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
 "
http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
 <class name="com.lwp.hibernate.Person" >
        <id name="id">
            <generator class="foreign">
                <param name="property">idCard</param>
            </generator>
       </id>
       <property name="name"/>
       <one-to-one name="idCard" constrained="true" />
 </class>
</hibernate-mapping>

 

 

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