Code:
table "projects" -- m:n --> "contact"
ends up in
Code:
"projects" <-- m:n -- "rel_proj_contact" -- n:m --> "contact"
until this point there's no problem. Hibernate resolves all contacts which are assigned to the project.
The fourth table has a relation to "rel_proj_contact".
Code:
"relationtype" <-- n:1 -- "rel_proj_contact"
Relationtype is for example "projectManager".
The Problem is to resolve a object of type "project" with all associated "contact"-objects that have "relationtype"-objects associated.
DATASET
Code:
<dataset>
<table name='PROJECTS'>
<column>id</column>
<row>
<value>50</value>
</row>
<row>
<value>51</value>
</row>
</column>
</table>
<table name='CONTACT'>
<column>id</column>
<row>
<value>100</value>
</row>
<row>
<value>101</value>
</row>
</column>
</table>
<table name='RELATIONTYPE'>
<column>id</column>
<row>
<value>200</value>
</row>
<row>
<value>201</value>
</row>
<row>
<value>202</value>
</row>
</column>
</table>
<table name='REL_PROJECTS_CONTACT'>
<column>projectid</column>
<column>contactid</column>
<column>relationid</column>
<row>
<value>50</value>
<value>100</value>
<value>200</value>
</row>
<row>
<value>50</value>
<value>101</value>
<value>201</value>
</row>
<row>
<value>51</value>
<value>101</value>
<value>202</value>
</row>
</column>
</table>
</dataset>
Any suggestions how to write the *.hbm-files. Target is to resolve everything in a object of type "project". thx for any answers