At leas according to the last threads I remember reading, the
fk-constraint goes as so:
/**
   * An Event has many Competitions
   *
   * @ejb:relation
   *     name="Event-Competition"
   *     role-name="Event-has-many-Competitions"
   * @jboss:relation
   *     fk-constraint="true"
   * @ejb:interface-method view-type="local"
   */
  public abstract Set getCompetitions();

  /**
   * @ejb:interface-method view-type="local"
   */
  public abstract void setCompetitions(Set competitions);

In CompetitionBean:

 /**
   * A Competition belongs to exactly one Event
   *
   * @ejb:relation
   *     name="Event-Competition"
   *     role-name="Competition-has-a-Event"
   *
   * @jboss:relation
   *     fk-column="event_fk"
   *     related-pk-field="id"
   *
   * @ejb:interface-method  view-type="local"
   */
  public abstract  com.interfaces.EventLocal getEvent();

  /**
   * @ejb:interface-method view-type="local"
   */
  public abstract void setEvent(com.interfaces.EventLocal event);



I do not know why it is coded like this, but have had a couple of
conversations and this seems to be what is "appropriate" as far as I
have tested it works fine.  However, the fk-constraint is on the
opposite side of the relation than it was in 1.1.2 (Counter intuitive to
me?)

Later,
Jake




-----Original Message-----
From: Ben Alex [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, September 18, 2002 7:28 AM
To: [EMAIL PROTECTED]
Subject: [Xdoclet-user] JBoss 3 with cmr fk-constraint - works with
1.1.2 but not CVS

Hi

I am having a problem with <fk-constraint> appearing in the wrong
location
when using the current CVS. When using XDoclet 1.1.2, the same XDoclet
tags
work fine.

In EventBean:

 /**
   * An Event has many Competitions
   *
   * @ejb:relation
   *     name="Event-Competition"
   *     role-name="Event-has-many-Competitions"
   * @ejb:interface-method view-type="local"
   */
  public abstract Set getCompetitions();

  /**
   * @ejb:interface-method view-type="local"
   */
  public abstract void setCompetitions(Set competitions);

In CompetitionBean:

 /**
   * A Competition belongs to exactly one Event
   *
   * @ejb:relation
   *     name="Event-Competition"
   *     role-name="Competition-has-a-Event"
   *
   * @jboss:relation
   *     fk-column="event_fk"
   *     related-pk-field="id"
   *     fk-constraint="true"
   *
   * @ejb:interface-method  view-type="local"
   */
  public abstract  com.interfaces.EventLocal getEvent();

  /**
   * @ejb:interface-method view-type="local"
   */
  public abstract void setEvent(com.interfaces.EventLocal event);

With XDoclet 1.1.2, the output is:

    <ejb-relation>
      <ejb-relation-name>Event-Competition</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>

<ejb-relationship-role-name>Event-has-many-Competitions</ejb-relationshi
p-ro
le-name>
          <key-fields>
             <key-field>
               <field-name>id</field-name>
               <column-name>event_fk</column-name>
             </key-field>
          </key-fields>
      </ejb-relationship-role>
      <ejb-relationship-role>

<ejb-relationship-role-name>Competition-has-a-Event</ejb-relationship-ro
le-n
ame>
          <fk-constraint>true</fk-constraint>
          <key-fields/>
      </ejb-relationship-role>
    </ejb-relation>

With XDoclet from today's CVS, the output is:

      <ejb-relation-name>Event-Competition</ejb-relation-name>
      <foreign-key-mapping/>
      <ejb-relationship-role>

<ejb-relationship-role-name>Competition-has-a-Event</ejb-relationship-ro
le-n
ame>
    <key-fields/>
      </ejb-relationship-role>
      <ejb-relationship-role>

<ejb-relationship-role-name>Event-has-many-Competitions</ejb-relationshi
p-ro
le-name>
          <fk-constraint>true</fk-constraint>
          <key-fields>
             <key-field>
               <field-name>id</field-name>
               <column-name>event_fk</column-name>
             </key-field>
          </key-fields>
      </ejb-relationship-role>
    </ejb-relation>
    <ejb-relation>

The XDoclet 1.1.2 output works correctly in that JBoss (built from CVS a
few
days ago) creates the foreign key against the database table. Also, if I
use
the XDoclet CVS output and move the <fk-constraint>true</fk-constraint>
from
the Event-has-many-Competitions relationship role to the
Competitions-has-a-Event relationship, JBoss also creates the foreign
key
correctly. But it doesn't work with the untouched output from XDoclet
CVS.

I've tried many different tags (including jboss:target-relation) and
read as
many posts as I could find on this subject, but to no avail. Any
suggestions
would be greatly appreciated.

Thanks

Ben



-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user


-------------------------------------------------------
This SF.NET email is sponsored by: AMD - Your access to the experts
on Hammer Technology! Open Source & Linux Developers, register now
for the AMD Developer Symposium. Code: EX8664
http://www.developwithamd.com/developerlab
_______________________________________________
Xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to