Hi , I have some problem mapping a many-to-many relation with the latest version of hibernate.
Table Question:
- Key1, pageId, questionId (compose the key)
- Some attributes
Table Reponses:
- Key1, pageId, questionId, responseId (compose the key)
- Some attributes
Relation Table called validResponses:
- Key1, pageId, questionId, responseId (compose the key)
- no attributes
* Key1 is the same for every table
I would like to have a Set of Response objects in the question object representing all the valid responses for a question but I can't find a way to map this many-to-many relation in my question.hbm.xml file.
I tried something like :
<set name="validResponses" table="valid_response" >
<key>
<column name="content_id"/>
<column name="page_id"/>
<column name="question_id"/>
</key>
<many-to-many class="questionnaire.bean.Response" >
<column name="content_id"/>
<column name="page_id"/>
<column name="question_id"/>
<column name="response_id"/>
</many-to-many>
</set>
But I got this error :
java.lang.RuntimeException: Exception building SessionFactory: Repeated column in mapping for collection: questionnaire.bean.Question.validResponses column: key1
Any idea ?
|