Hello all,
I need your help and your opinion about my architecture schema.
I use Hibernate 2.1.2, JBoss 3.2.3 and JDK 1.4.2 with EJB and Struts.
I use Middlegen and Hbm2java to generate my mappinf files and my POJO.
But my problem is how to represent the association between 2 tables.
For example, I have one table A and one B and another C who is only composed by the foreygn key of A and B and another field for example a date.
For my other tables only composed by foreign keys I use a many to many reprensetation mapping and all works fine.
But the the specific case with some fields in the association table I use 2 links many to one like this :
<set name="languageCandidateValueObjects"
lazy="true"
cascade="all"
inverse="true"
>
<key>
<column name="CAN_SEQID" />
</key>
<one-to-many class="com.mcstechnology.mcsrecrutement.valueobject.LanguageCandidateValueObject"/>
</set>
LanguageCandidate is the representation of my table C, I use a composite-id for this.
The delete works well with the flag insert =true and I thing for the update to.
But if i try to insert a new row, Hibernate generates a new row for A but for C it tries to update the table and the foreign constraint is violated.
I try some possibilities and it's always the same thing. Insert and then update.
Thanks in advance for your responses and if you need more detail I can give you.
I want to know your opinion about my model if it's good or not
|