-
1. Re: CMR with EJB2.0 + JBoss3.2
sesques Mar 5, 2004 5:16 PM (in response to mandarjboss)Look at the jbosscmp-jdbc.xml the <key-fields> tag corresponding to your relationship role name
If you cannot find the problem, post the file
I hope this helps you -
2. Re: CMR with EJB2.0 + JBoss3.2
mandarjboss Mar 8, 2004 4:00 AM (in response to mandarjboss)Hi sesques,
Thanx for ur reply.I really could not figure out the problem.
Well I have now changed the database schema as
Question
q_id
q_text
rightChoice
choiceid
Choice
choiceid
choice1
choice2
choice3
Well the portion of ejb-jar.xml is not much different.
As u can see from the database structure i want my choiceid column in Question table to act as a Foreign-key for Choice table's choiceid primary key.
Even after these settings the same problem which i have mentioned above still persists.JBoss is still creating a new Field "Choices" probably corresponding to "ChoicesLocal getChoices()".But this is a CMR field then why does JBOss creates a column for that field..?
Really cant understand.Please help me.
Here is a snippet of jbosscmp-jdbc.xml generated by XDoclet for me.
<ejb-relation>
<ejb-relation-name>Question-Has-A-Choices</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Question-Of-A-Choice
</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Choices-Of-A-Question
</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>choiceid</field-name>
<column-name>choiceid</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation> -
3. Re: CMR with EJB2.0 + JBoss3.2
aquila125 Mar 8, 2004 4:15 AM (in response to mandarjboss)try this in your jbosscmp-jdbc.xml file:
<ejb-relation>
<ejb-relation-name>Question-Has-A-Choices</ejb-relation-name>
<ejb-relationship-role>
<ejb-relationship-role-name>Question-Of-A-Choice
</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Choices-Of-A-Question
</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>choices</field-name>
<column-name>choiceid</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation> -
4. Re: CMR with EJB2.0 + JBoss3.2
mandarjboss Mar 8, 2004 9:09 PM (in response to mandarjboss)Thanx a....Lot aquilla125 it seems that your logic is working.You are extremely intellegent.
Can u help me regarding the problem of auto-increment of primary key with Jboss3.2 and PostgreSQL7.3 ? -
5. Re: CMR with EJB2.0 + JBoss3.2
aquila125 Mar 9, 2004 2:19 AM (in response to mandarjboss)I don't consider myself more intelligent then the next guy, but I've been sweating over the same problems these last few weeks :)
About your problem with the auto-increment... are you sure you added the <auto-increment/> tag to the correct fields in jbosscmp-jdbc.xml?
Also, in the default section add this tag:
<entity-command name="postgresql-fetch-seq"/>