I am using an outdated compound key database schema. I have an entity with two relationships, and one of the join columns is shared.
For example, let them say that I have a student entity with two relations Department and Course. The department uses the dept_code column, while the course uses dept_code and code_path. The domain model is such that a student can belong to a department, but did not choose a course, or a student could choose both a department and a course. This is how sleep mode looks:
<many-to-one class="Department" name="department">
<column name="dept_code"/>
</many-to-one>
<many-to-one class="Course" name="course>
<column name="dept_code"/>
<column name="course_code"/>
</many-to-one>
The problem is that Hibernate does not allow this mapping if one of the relationships is not checked only with insert = false and update = false.
Is there a way that both relationships are writable?