It would be something like this:
class Other{
@OneToOne
Employee employe;
}
class Employee {
@OneToOne(mappedBy = "empolyee", cascade = CascadeType.SAVE_UPDATE)
Other other;
}
Вопрос
<one-to-one name="employee" class="com.test.study.model.employee"
cascade="save-update"> </one-to-one>
I'm thinking:
OneToOne(fetch = FetchType.LAZY, mappedBy = "com.test.study.model.employee", cascade = CascadeType.All)
But then, do I do the same thing in the other table as well?
Решение
It would be something like this:
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;