facebook

Xdoclet-foreign keys

  1. MyEclipse IDE
  2.  > 
  3. Feature Requests
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #214323 Reply

    rtosi
    Member

    Hi,
    I’ve a problem with foreign keys:

    I have a table Resources like this : rid (pk) – cid – rname

    I’have to create another table like this : did (pk) – dep- rid1 (fk) -rid2(fk)

    I have 2 EJB-CMP : ResourcesBean and DepBean for the first and the second table. In ResourceBean I have getRid() and setRid().

    In the DepBean I have to use setRid1() and setRid2().
    For getter and setter rid1 I have :
    /**
    * @ejb.relation
    * name=”did-rid1″
    * role-name=”dep-has-rid1″
    * target-ejb = “Resource”
    *
    * @jboss.relation related-pk-field = “rid”
    * fk-column = “rid1″
    *
    *
    *
    */
    public abstract ResourceLocal getRid1();

    public abstract void setRid1(ResourceLocal c);

    …and for rid2 ???

    I can’t use :

    /**
    * @ejb.relation
    * name=”did-rid1″
    * role-name=”dep-has-rid1”
    * target-ejb = “Resource”
    *
    * @jboss.relation related-pk-field = “rid”
    * fk-column = “rid2”
    *
    *
    *
    */
    public abstract ResourceLocal getRid2();

    public abstract void setRid2(ResourceLocal c);

    ….beacuse there is the same role-name and the same name…..

    What is the solution…..I tried a lot of tricks but I’m not able to resolve this problem….

    Thank you very much for the answer !!

    #214425 Reply

    Riyad Kalla
    Member

    I have asked our Xdoclet guru to look at this for you.

    #214447 Reply

    Greg
    Member

    Can the Dependent beans only have two resource beans they are associated with? I just wondering if it would be easier to have a many-to-many relationship here. So you would have a link table that would contain:

    did(fk) – rid(fk)

    So for as many rids that the did has there would be a corresponding record in the link table. Just standard many-to-many relationship. I think that would be easier to setup in xdoclet as well.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Xdoclet-foreign keys

You must be logged in to post in the forum log in