<hibernate-mapping package="com.java1234.model"> <class name="Student" table="t_student"> <id name="id" column="stuId"> <generator class="native"></generator> </id> <property name="name" column="stuName"></property> <many-to-one name="c" column="classId" class="com.java1234.model.Class" cascade="save-update"></many-to-one> </class> </hibernate-mapping>
<hibernate-mapping package="com.java1234.model"> <class name="Class" table="t_class"> <id name="id" column="classId"> <generator class="native"></generator> </id> <property name="name" column="className"></property> </class> </hibernate-mapping>
<mapping resource="com/java1234/model/Student.hbm.xml"/> <mapping resource="com/java1234/model/Class.hbm.xml"/>
hibernate一对多映射
最新推荐文章于 2024-07-25 10:39:41 发布