Fw: [问题] Hibernate的oneToMany与ManyToOne的意义

楼主: lueichun (no anonymous)   2021-01-30 14:59:06
※ [本文转录自 java 看板 #1W2jyiQF ]
作者: lueichun (= =) 看板: java
标题: [问题] Hibernate的oneToMany与ManyToOne的意义
时间: Fri Jan 22 22:20:26 2021
※状况概述:
以下的程式,有City跟Country两个类别,city跟country是多对一的关系,
程式可以正常运作:
City类别:
public class City {
private int cityId;
private String cityName;
private Country country;
......
}
City的映射档:
<hibernate-mapping package="com.test.vo">
<class name="City" table="CITY">
<id name="cityId" column="CITY_ID">
<generator class="increment"/>
</id>
<property name="cityName" column="CITY_NAME" />
<many-to-one name="country" column="COUNTRY_ID" class="com.test.vo.Country"
cascade="all"/><!

Links booklink

Contact Us: admin [ a t ] ucptt.com