Uploaded image for project: 'Hibernate ORM'
  1. HHH-10574

In hibernate 5 Schema update re create foreign keys and unique keys against hibernate 4 DB

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects versions: 5.0.7
    • Fix versions: None
    • Components: hibernate-core
    • Labels:
      None
    • Environment:
      Wildfly 10 Final, Hibernate 5.0.7, Mysql 5.5
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true
    • Sprint:

      Description

      When migrating from hibernate 4 to 5 and having
      hibernate.hbm2ddl.auto to update
      hibernate.implicit_naming_strategy to legacy-jpa
      in the persistence.xml.

      During the SchemaUpdate hibernate 5 recreate the databases foreign keys and unique keys when running against an existing database (hibernate 4 generated database).
      Also the foreign key/unique key prefix are difference. Hibernate 4 uses UK_ or FK_ where as hibernate use UK or FK. Also the foreign key hash key has changed too.

      see https://forums.hibernate.org/viewtopic.php?f=1&t=1042969 for more information.

      The attachment foreignkeybefore.sql shows the schema after running against hibernate 4 and foreignkeyafter.sql show the same schema after upgrading to hibernate 5.
      foreighkeyentities.zip contains the entities i used to generate the database

        Attachments

          Activity

            People

            • Votes:
              12 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

              • Created:
                Updated: