<one-to-one name="employee" class="com.test.study.model.employee"
cascade="save-update"> </one-to-one>
我在想:
OneToOne(fetch = FetchType.LAZY, mappedBy = "com.test.study.model.employee", cascade = CascadeType.All)
但是,我是否也在另一张桌子上做同样的事情?
<one-to-one name="employee" class="com.test.study.model.employee"
cascade="save-update"> </one-to-one>
我在想:
OneToOne(fetch = FetchType.LAZY, mappedBy = "com.test.study.model.employee", cascade = CascadeType.All)
但是,我是否也在另一张桌子上做同样的事情?
它会是这样的:
class Other{
@OneToOne
Employee employe;
}
class Employee {
@OneToOne(mappedBy = "empolyee", cascade = CascadeType.SAVE_UPDATE)
Other other;
}
import com.test.study.model.employee;
@OneToOne(mappedBy="employee", cascade=CascadeType.ALL)
private employee emp;