#386 Intra-Bean Many to Many auto-gen broken

v3.0 Rabbit Hole
closed-fixed
JBossCMP (436)
5
2002-04-09
2002-03-15
No

When attempting to create an EJB that has a
bidirectional many-to-many relationship with itself,
JBoss attempts to create a relationship table that has
duplicate columns.

My bean (Company) has the following code:

/**
* @ejb:interface-method
* @ejb:relation name="Companies-Investors"
* role-name="investees"
* multiple="yes"
* @jboss:auto-key-fields
*/
public abstract Collection getInvestees();

/**
* @ejb:interface-method
* @ejb:relation name="Companies-Investors"
* role-name="investors"
* multiple="yes"
* @jboss:auto-key-fields
*/
public abstract Collection getInvestors();

Upon deployment, JBoss produces the following SQL code
for the database:

CREATE TABLE Company_investees_Company_investors
(Company TEXT NOT NULL, Company TEXT NOT NULL,
CONSTRAINT pk_Company_investees_Company_investors
PRIMARY KEY (Company, Company))

Note the duplicate column names.

Discussion

  • Dain Sundstrom
    Dain Sundstrom
    2002-03-15

    Logged In: YES
    user_id=251431

    oh ya, duh. I'll fix this.

     
  • Dain Sundstrom
    Dain Sundstrom
    2002-03-15

    • assigned_to: nobody --> dsundstrom
    • summary: Intra-Bean Many to Many relationship don --> Intra-Bean Many to Many auto-gen broken
    • status: open --> open-accepted
     
  • Dain Sundstrom
    Dain Sundstrom
    2002-04-09

    • status: open-accepted --> closed-fixed
     
  • Dain Sundstrom
    Dain Sundstrom
    2002-04-09

    Logged In: YES
    user_id=251431

    I corrected the auto generation code for this case, and
    tested that the relationship actually works.