Hibernate ORM
  1. Hibernate ORM
  2. HHH-8162

Make unique constraint handling on schema update configurable

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.1, 4.3.0.Beta2
    • Component/s: None
    • Labels:
      None
    • Last commented by a user?:
      true

      Description

      HHH-7797 forced uniqueness to be defined by constraints through alter table statements. HHH-8092 identified that this was not occurring on schema updates.

      Since HHH-1904 resulted in non-explicitly-named constraint names using randomly-generated characters, checking for a constraint's existence prior to creating it on a schema update is not always possible. This leads to errors.

      We cannot simply remove unique constraint generation on an update all-together. Instead, let's make it configurable. A property would select from the following:

      1.) Update ignores all unique constraints
      2.) Update attempts to (re-)create the unique constraints and ignores any errors (with warn log)

      I'd argue that #2 would be the default.

      More info: http://lists.jboss.org/pipermail/hibernate-dev/2013-April/009592.html

        Issue Links

          Activity

          Hide
          Brett Meyer added a comment -

          Pull request: https://github.com/hibernate/hibernate-orm/pull/512

          Please review and add comments.

          Show
          Brett Meyer added a comment - Pull request: https://github.com/hibernate/hibernate-orm/pull/512 Please review and add comments.
          Hide
          Brett Meyer added a comment -

          Also added "Update attempts to drop, then (re-)create the unique constraints and ignores any errors (with warn log)".

          Show
          Brett Meyer added a comment - Also added "Update attempts to drop, then (re-)create the unique constraints and ignores any errors (with warn log)".
          Show
          Brett Meyer added a comment - https://bugzilla.redhat.com/show_bug.cgi?id=979098 https://bugzilla.redhat.com/show_bug.cgi?id=979103

            People

            • Assignee:
              Brett Meyer
              Reporter:
              Brett Meyer
              Participants:
            • Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development