Hibernate映射:沒有Hibernate映射入門級數據
我有以下兩類:
class Employee{
int empId;
string name;
float salary;
Department dept;
// ... getters and setters....
}
class Department{
int deptId;
string deptName;
// ....and other details, getter and setters..
}
現在我有表,員工只喜歡
table Employee(EmpId number, Name varchar, salary number,deptId number)
沒有必要請保留Department
的表格,因爲我只對存儲具有dept id的員工數據感興趣。
我找hibernate mapping
許多到一,一到一,一到多,但所有存儲dept data
單獨table
需要。
我的問題:有沒有辦法只保留簡單的映射文件,我可以從Department class
Employee mapping
訪問deptId
?
感謝