glassfish
  1. glassfish
  2. GLASSFISH-3252

Duplicate constraint generated for Derby when @Id field has @Column(unique=true)

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 9.1pe
    • Fix Version/s: not determined
    • Component/s: entity-persistence
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      3,252
    • Status Whiteboard:
      Hide

      HIGH

      Show
      HIGH

      Description

      The entity specifies a redundant information /@Column(unique=true)/ for an @Id
      field, as shown below:

      @Entity
      public class A{
      @Id
      @Column(unique=true)
      String id;
      }

      That causes ddl-generation to fail because the generated SQL is not accepted by
      Derby. The driver used is "Apache Derby Network Client JDBC Driver Version:
      10.2.2.1." Full test case will be attached. I have spoken to Derby engineers and
      they told that the Derby behavior is SQL compliant. I don't think the entity
      code is incorrect, as having an extra constraint specification is not spec
      non-compliant. Hence, DDL-generation code should be aware of Derby behavior and
      generate appropriate code.

      The error message is shown below:
      [TopLink Warning]: 2007.06.26 09:19:30.411-ServerSession(26094370)-Exception
      [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b52-rc (06/20/2007))):
      oracle.toplink.essentials.exceptions.DatabaseException
      Internal Exception: java.sql.SQLException: Constraints 'SQL070626091930361' and
      'SQL070626091930360' have the same set of columns, which is not allowed.
      Error Code: -1
      Call: CREATE TABLE A (ID VARCHAR(255) UNIQUE NOT NULL, PRIMARY KEY (ID))

      – Sahoo

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        Created an attachment (id=991)
        Follow the trivial steps mentioned in the README to reproduce the error

        Show
        Sanjeeb Sahoo added a comment - Created an attachment (id=991) Follow the trivial steps mentioned in the README to reproduce the error
        Hide
        pkrogh added a comment -

        Straight forward to work around. Downgrading to P4 HIGH.

        Show
        pkrogh added a comment - Straight forward to work around. Downgrading to P4 HIGH.
        Hide
        gfbugbridge added a comment -

        <BT6574307>

        Show
        gfbugbridge added a comment - <BT6574307>
        Hide
        Tom Mueller added a comment -

        Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

        Show
        Tom Mueller added a comment - Bulk change to set fix version to "not determined" where the issue is open but the value is for a released version.

          People

          • Assignee:
            tware
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: