glassfish
  1. glassfish
  2. GLASSFISH-702

Can't update a primary key of a composite key.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 9.1pe
    • Fix Version/s: 9.1pe_dev
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      702

      Description

      I'm trying to update one of my primary key columns of a composite key. Toplink
      does attempt the update, but the 'where clause' contains the new value instead
      of the old, which means the update fails because there is no match.

      example:

      // a and b are primary keys
      int a;
      int b;

      a=1, b=1.

      If I change b=2, toplink issues an update that says "update b=2 where a=1 and
      b=2". It should say "... and b=1".

        Activity

        Hide
        marina vatkina added a comment -

        It's a really bad practice to change primary keys, and the spec has the
        following statements about this:
        " The application must not change the value of the primary key[8].
        [8] This includes not changing the value of a mutable type that is primary key
        or element of a composite primary key."

        Though the spec doesn't require to throw an exception either, I'd prefer that we
        do so.

        -marina

        Show
        marina vatkina added a comment - It's a really bad practice to change primary keys, and the spec has the following statements about this: " The application must not change the value of the primary key [8] . [8] This includes not changing the value of a mutable type that is primary key or element of a composite primary key." Though the spec doesn't require to throw an exception either, I'd prefer that we do so. -marina
        Hide
        marina vatkina added a comment -

        Reassigned

        Show
        marina vatkina added a comment - Reassigned
        Hide
        gfbugbridge added a comment -

        <BT6443431>

        Show
        gfbugbridge added a comment - <BT6443431>
        Hide
        mf125085 added a comment -

        An exception should be thrown whenever a non-updatable field is set. This
        applies to primary key fields.

        Show
        mf125085 added a comment - An exception should be thrown whenever a non-updatable field is set. This applies to primary key fields.
        Hide
        mf125085 added a comment -

        The validation preventing PK updates is now implemented in method
        writeFromObjectIntoRowWithChangeRecord() of classes AbstractDirectMapping and
        OneToOneMapping.

        Please see

        http://fisheye5.cenqua.com/changelog/glassfish/?cs=MAIN:mf125085:20060918204828

        Show
        mf125085 added a comment - The validation preventing PK updates is now implemented in method writeFromObjectIntoRowWithChangeRecord() of classes AbstractDirectMapping and OneToOneMapping. Please see http://fisheye5.cenqua.com/changelog/glassfish/?cs=MAIN:mf125085:20060918204828

          People

          • Assignee:
            mf125085
            Reporter:
            carminerimi
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: