Bugs item #531811, was opened at 2002-03-19 07:06
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=402704&aid=531811&group_id=31602
Category: jboss
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: JBoss 3 Relationship Mapping fails
Initial Comment:
Hi,
I have a Partner bean that has a one-to-many
unidirectional relationship with Adresse bean.
I want a foreign-key-mapping such that in the Adresse
table the appropriate partner bean is referenced by
its partnerId.
To achieve this, you need an entry like this in
jbosscmp-jdbc.xml:
<ejb-relation>
<ejb-relation-name>Partner-Adressen</ejb-
relation-name>
<foreign-key-mapping>
<ejb-relationship-role>
<ejb-relationship-role-name>Partner
hat viele Adressen</ejb-relationship-role-name>
<foreign-key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Adressen
sind einem Partner zugeordnet</ejb-relationship-
role-name>
<foreign-key-fields>
<foreign-key-field>
<field-name>partnerId</field-name>
<column-name>partnerId</column-name>
</foreign-key-field>
</foreign-key-fields>
</ejb-relationship-role>
</foreign-key-mapping>
</ejb-relation>
However, the JBoss subtask creates the following:
<ejb-relation>
<ejb-relation-name>Partner-Adressen</ejb-
relation-name>
<foreign-key-mapping/>
<ejb-relationship-role>
<ejb-relationship-role-name>Partner
hat viele Adressen</ejb-relationship-role-name>
<key-fields/>
</ejb-relationship-role>
<ejb-relationship-role>
<ejb-relationship-role-name>Adressen
sind einem Partner zugeordnet</ejb-relationship-
role-name>
<key-fields>
<key-field>
<field-name>partnerId</field-name>
<column-name>partnerId</column-name>
</key-field>
</key-fields>
</ejb-relationship-role>
</ejb-relation>
Note the differences: the foreign-key-mapping/ tag
above is empty and doesn't correctly include the ejb-
relationship-role elements as it should. Tags are
named key-fields(s) instead of the correct foreign-key-
fields. I looked at the DTD
(http://www.jboss.org/j2ee/dtd/jbosscmp-jdbc_3_0.dtd)
and thanks to it constructed my first (correct)
version.
In my Partner bean I have the following relation-
related tags for the appropriate getter:
/**
* @ejb:relation name="Partner-Adressen"
role-name="Partner hat
* viele Adressen" target-ejb="Adresse"
target-role-name="Adressen sind
* einem Partner zugeordnet" target-cascade-
delete="yes"
* target-multiple="no"
* @ejb:interface-method
* @jboss:relation related-pk-field="partnerId"
* fk-column="partnerId"
*/
public abstract java.util.Collection getAdressen();
I also tried jboss:target-relation and different other
combinations but none of them yielded the correct
result. My only option right now seems changing the
jbosscmp-jdbx.xml manually which sure isn't a nice
solution. Is this jboss:relation tag buggy or is there
something wrong with my use of it?
Thanks!
Bernhard
----------------------------------------------------------------------
Comment By: Marcus Brito (pazu)
Date: 2002-03-19 08:27
Message:
Logged In: YES
user_id=360347
Bernhard,
First, please note that the DTD for jbosscmp-jdbc.xml has
changed substantially in the latest CVS versions. The
<key-field/> tags are correct according to the latest DTD,
and this xDoclet task was designed to work with this newer DTD.
Update your jboss to the latest CVS version. If you're
unable to do that, sorry, you're out of luck. xDoclet is a
tool ahead of its time :)
Anyway, there is a slight mistake in your tags. You should
use @ejb:target-relation instead of @ejb:relation as you're
defining related-pk-field and fk-column for the target
relation, not for the current one.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=402704&aid=531811&group_id=31602
_______________________________________________
Xdoclet-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-devel