When specifying a unique constraint on a join table, if the columns of the constraint match that of the primary key generated for the join table, the unique constraint will be removed based on the following documentation in org.hibernate.mapping.Table#cleanseUniqueKeyMap():
For situations where a unique constraint has a user specified name and the columns map to those of the join-table's primary key, allow that constraint name to influence the primary key's name instead. We should document this and clearly indicate that depending on the dialect, some databases don't permit named primary keys and in those cases, the name will still be dropped and ignored. |