#1097 CMR is also a PK: none of the CMR columns are created

v3.2
closed-fixed
JBossCMP (436)
5
2003-01-31
2003-01-28
Moi
No

Pre-3.2, when one of the cmr fields (in a one-to-
many relationship) was a PK field of the many-
bean, the cmr field was duplicated in the many-
bean table.
I compiled 3.2.0RC2 from CVS this morning and the
behaviour is different but the problem has not been
fixed. Now, none of the cmr fields are added to the
many-bean table when one of the cmr field is also
a PK in the many-bean.

To be more concrete:

Bean1 (PK = context + name)
-context
-name
-description

Bean2 (PK = context + ID)
-context
-ID
-quantity

I have a one-to-many relationship between both
beans (Bean1 has many Bean2).

I declare the cmr fields as follow:
<key-field>
<field-name>context</field-name>
<column-name>context</column-name>
</key-field>
<key-field>
<field-name>name</field-name>
<column-name>Bean1_Name</column-name>
</key-field>

The context column is not duplicated in the Bean2
table, which is what we want (in pre-3.2 we would
have ended up with two 'context' columns in the
bean2 table). The problem is that the Bean1_Name
column is not added either.

If I change the declaration as follow:

<key-field>
<field-name>context</field-name>
<column-name>context_foo</column-name>
</key-field>
<key-field>
<field-name>name</field-name>
<column-name>Bean1_Name</column-name>
</key-field>

Both columns are added the the Bean2 table.

Environment:
jboss 3.2.0RC2
NT
HSQL
Sun jdk 1.3.1_03

Discussion

  • Alexey Loubyansky

    • assigned_to: nobody --> loubyansky
    • status: open --> open-accepted
     
  • Alexey Loubyansky

    Logged In: YES
    user_id=543482

    Fixed in 3.2 and HEAD. (3.0 doesn't support FK to PK
    mapping at all)

    alex

     
  • Alexey Loubyansky

    • status: open-accepted --> closed-fixed
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks