OpenJPA
  1. OpenJPA
  2. OPENJPA-340

@UniqueConstraint and corresponding XML ignored

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None

      Description

      OpenJPA ignores @UniqueConstraint annotations (and the corresponding XML declaration) when generating database schemas. This should be rectified.

      A workaround is to set the -ignoreErrors flag to true when running mappingtool, which will let schema creation continue despite the error.

        Issue Links

          Activity

          Hide
          Pinaki Poddar added a comment -

          Currently partial support exists. Unique constraints can be specified at @Table annotation is processed.

          For example, given

          @Entity
          @Table(name="Person",uniqueConstraints=@UniqueConstraint(columnNames=

          {"first","last"}

          ))
          public class Person

          { @Id private long id; private String first; private String last; }

          will generate following table schema
          CREATE TABLE Person (id BIGINT NOT NULL, first VARCHAR(255), last VARCHAR(255), PRIMARY KEY (id), UNIQUE (first, last))

          Show
          Pinaki Poddar added a comment - Currently partial support exists. Unique constraints can be specified at @Table annotation is processed. For example, given @Entity @Table(name="Person",uniqueConstraints=@UniqueConstraint(columnNames= {"first","last"} )) public class Person { @Id private long id; private String first; private String last; } will generate following table schema CREATE TABLE Person (id BIGINT NOT NULL, first VARCHAR(255), last VARCHAR(255), PRIMARY KEY (id), UNIQUE (first, last))
          Hide
          Andy Schlaikjer added a comment -

          looks like @JoinTable(uniqueConstraints=...) is not supported either.

          Show
          Andy Schlaikjer added a comment - looks like @JoinTable(uniqueConstraints=...) is not supported either.
          Hide
          Amy Yang added a comment -

          looks like only @Table(uniqueConstraints=@UniqueConstraint(....)) is supported.
          @SecondaryTable, @JoinTable, and @TableGenerator need be supported.

          Show
          Amy Yang added a comment - looks like only @Table(uniqueConstraints=@UniqueConstraint(....)) is supported. @SecondaryTable, @JoinTable, and @TableGenerator need be supported.

            People

            • Assignee:
              Unassigned
              Reporter:
              Patrick Linskey
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development