0
 <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)

但是,我是否也在另一张桌子上做同样的事情?

4

2 回答 2

0

它会是这样的:

class Other{
    @OneToOne
    Employee employe;
}

class Employee {
    @OneToOne(mappedBy = "empolyee", cascade = CascadeType.SAVE_UPDATE)
    Other other;
}
于 2013-06-27T03:10:06.220 回答
0
import com.test.study.model.employee; 

@OneToOne(mappedBy="employee", cascade=CascadeType.ALL)
private employee emp;
于 2013-06-27T03:14:42.610 回答