-
1. Re: Problem with XDoclet generated deployment discriptors
jcordes Mar 19, 2003 2:57 PM (in response to sczadzeck)Hi Scott !
The section in jbosscmp-jdbc.xml should look like this:
<ejb-relation> <ejb-relation-name>Instruction-Items</ejb-relation-name>
<foreign-key-mapping/>
<ejb-relationship-role> <ejb-relationship-role-name>item-belongs-to-instruction</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>instruction-has-items</ejb-relationship-role-name>
<key-fields>
<key-field>
<field-name>id</field-name>
<column-name>instruction_id</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
What seems to be of matter here is that the key-field entries in your case may be swapped.
The deployment entries above can be generated by using these XDoclet-Tags (assuming the relation is bidirectional for ease ;-) ):
Instruction
/**
* @ejb.interface-method
* @ejb.relation name="Instruction-Item"
* role-name="instruction-has-items"
*/
public abstract Collection getItems();
Item
/**
* @ejb.interface-method
* @ejb.relation name="Instruction-Item"
* role-name="item-belongs-to-instruction"
* @jboss.relation related-pk-field="id" fk-column="instruction_id"
*/
public abstract InstructionEJBLocal getInstruction();
Hope it helps,
Jochen. -
2. Re: Problem with XDoclet generated deployment discriptors
sczadzeck Mar 24, 2003 5:20 PM (in response to sczadzeck)That solved my problem. You are my saviour! :-)
Scott -
3. Re: Problem with XDoclet generated deployment discriptors
goldrimtang Mar 30, 2003 6:54 PM (in response to sczadzeck)I had the same problem, but I couldn't move the @jboss.relation tag to the other entity bean because the relationship is unidirectional.
The way to solve this was using @jbos.target-relation. I found this quite obscure and almost undocumented, but works fine.