Hi all,
Please help me... I'm can't seem to get this to work.
I have 2 CMP beans. Which relate as follows:
+-----------------+ +-----------------+
| Advertisement |-1--------------------N-| Correction |
+-----------------+ +-----------------+
I'm trying to use XDoclet to generate the CMP-CMR code:
Here are my Advertisement-bean class code:
=============================================================================
/** @ejb.bean
* name = "Advertisement"
* display-name = "A object representing an Advertisement"
* type = "CMP"
* transaction-type = "Container"
* view-type = "local"
* local-jndi-name = "Advertisement"
* @jboss:table-name table-name="Advertisement"
* @jboss:create-table create="true"
* @jboss:remove-table remove="true"
*
* @ejb.ejb-ref
* ejb-name = "Correction"
*/
public abstract class AdvertisementEJB implements EntityBean {
/**
* @ejb.relation
* name="Advertisement-Correction"
* role-name="Advertisment-has-many-Corrections"
* target-cascade-delete="yes"
* target-ejb="Correction"
* target-role-name="Correction-belongs-to-Advertisement"
* target-multiple="no"
*/
public abstract Collection getCorrections();
public abstract void setCorrections(Collection corrections);
// THE REST OF THE CLASS GOES HERE>...
===============================================================================
When I run XDoclet, it generates this ejb-jar.xml:
<!-- Relationships -->
<relationships >
<ejb-relation >
<ejb-relation-name>Advertisement-Correction</ejb-relation-name>
<ejb-relationship-role >
<ejb-relationship-role-name>Advertisment-has-many-Corrections</ejb-relationship-role-name>
<multiplicity>One</multiplicity>
<relationship-role-source >
<ejb-name>Advertisement</ejb-name>
</relationship-role-source>
<cmr-field >
<cmr-field-name>corrections</cmr-field-name>
<cmr-field-type>java.util.Collection</cmr-field-type>
</cmr-field>
</ejb-relationship-role>
<ejb-relationship-role >
<ejb-relationship-role-name>Correction-belongs-to-Advertisement</ejb-relationship-role-name>
<multiplicity>Many</multiplicity>
<cascade-delete/>
<relationship-role-source >
<ejb-name>Correction</ejb-name>
</relationship-role-source>
</ejb-relationship-role>
</ejb-relation>
</relationships>
But this doesn't work! JBoss complains:
Atleast one role of a foreign-key mapped relationship must have key
fields: ejb-relation-name=Advertisement-Correction]
I can't seem to find any good example on how to create a simple relation
like the above. (I have looked in the XDoclet examples, xPetStore, etc..).
Can somebody please help me? Or at least push me into the right direction?
Many thanks,
Harm de Laat
Informatiefabriek
The Netherlands
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user