Hibernate
one2many类型的关联关系的维护
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd"> <hibernate-mapping package="com.layne.beans"> <class name="Minister"> <id name="mid"> <generator class="native"></generator> </id> <property name="mname"/> <!-- 关联属性映射 --> <many-to-one name="country" cascade="save-update" class="Country" column="countryId" /> </class> <class name="Country"> <id name="cid"> <generator class="native"></generator> </id> <property name="cname"/> <!-- 对关系关联映射关系 --> <set name="ministers" cascade="save-update" inverse="true"> <key column="countryId"/> <one-to-many class="Minister"/> </set> </class> </hibernate-mapping>