[hibernate-issues] [Hibernate-JIRA] Created: (HBX-939) Composite IDs and many-to-many relationships

Markus Kramer (JIRA) noreply at atlassian.com
Fri May 4 15:19:04 EDT 2007


Composite IDs and many-to-many relationships
--------------------------------------------

                 Key: HBX-939
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HBX-939
             Project: Hibernate Tools
          Issue Type: Bug
    Affects Versions: 3.2beta9
         Environment: Hibrnate 3.2.1, Postgresql 8.1.8
            Reporter: Markus Kramer
         Attachments: B.hbm.xml, testdb.sql

The detection of many-to-many relationships doesn't work correctly if the primary key of one of the involved tables consists of more than one field.

An example:
One of two tables (table 'A') of a many-to-many relationship has a primary key consisting of two attributes (id1 and id2).
The generated B.hbm.xml for the table 'B' contains this:

        <set name="as" inverse="true" table="a_b">
            <key>
                <column name="b_id" not-null="true" />
            </key>
            <many-to-many entity-name="test.A">
                <column name="a_id1" not-null="true" />
            </many-to-many>
        </set>

But there should be another entry for the referenced primary key:
<column name="a_id2" not-null="true" />

The SQL code for the used tables and the complete B.hbm.xml are attached.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list