Menu

#171 Duplicate set names generated in *.hbm.xml

open
hibernate (22)
5
2005-03-03
2005-03-03
No

TableX has a many-to-many relationship with TableY,
and TableX also has a one-to-many relationship with
TableY. In the TableX.hbm.xml, Middlegen generates
both of these associations using the same set name
<set name="TableYs"..../>

I've found that if there are several one-to-many
relationships from TableX to TableY, middlegen will
correctly see this and generate unique associations by
including the column name in the name of the set.

Likewise, when there are multiple many-to-many
relationships between TableX and TableY, middlegen will
correctly see this and generate unique assocations.

The problem only appears to happen when both many-to-
many and one-to-many relationships exist between two
tables.

Discussion

  • David Channon

    David Channon - 2005-07-10

    Logged In: YES
    user_id=582419

    Thanks - can you supply a small script - minimal tables and
    columns showing the db structure that would replicate this
    please.

     
  • Nobody/Anonymous

    Logged In: NO

    I've the same problem. Has any patch been issued?

     
  • Nobody/Anonymous

    Logged In: NO

    CREATE TABLE t0100_organisation_unit (
    pk_0100 integer NOT NULL,
    unit_id_0100 VARCHAR2(50),
    )
    ;

    CREATE TABLE t0155_survey (
    pk_0155 integer NOT NULL,
    survey_id_0155 VARCHAR2(50),
    name_0155 VARCHAR2(100),
    fk_0100_organisation_unit integer NOT NULL,
    )
    ;

    CREATE TABLE t0275_other_unit (
    pk_0275 integer NOT NULL,
    fk_0100_organisation_unit integer NOT NULL,
    fk_0155_survey integer NOT NULL
    )
    ;

    ALTER TABLE t0100_organisation_unit ADD CONSTRAINT
    PK_t0100_organisation_unit
    PRIMARY KEY (pk_0100)
    ;

    ALTER TABLE t0155_survey ADD CONSTRAINT
    PK_t0155_survey
    PRIMARY KEY (pk_0155)
    ;

    ALTER TABLE t0275_other_unit ADD CONSTRAINT
    PK_t0275_other_unit
    PRIMARY KEY (pk_0275)
    ;

    ALTER TABLE t0155_survey ADD CONSTRAINT
    FK_fk_0100_0155
    FOREIGN KEY (fk_0100_organisation_unit) REFERENCES
    t0100_organisation_unit (pk_0100)

    ALTER TABLE t0275_other_unit ADD CONSTRAINT
    FK_fk_0100_0275
    FOREIGN KEY (fk_0100_organisation_unit) REFERENCES
    t0100_organisation_unit (pk_0100)
    ;

    ALTER TABLE t0275_other_unit ADD CONSTRAINT
    FK_fk_0155_0275
    FOREIGN KEY (fk_0155_survey) REFERENCES
    t0155_survey (pk_0155)
    ;

     

Log in to post a comment.