HBM mapping: Customize unique key name for many-to-one with orphan-delete cascading fails

Description

Some background about this issue can be found in the Hibernate forum here:
https://forum.hibernate.org/viewtopic.php?f=1&t=1043689&sid=333833f9c9690a36a4b468f5c32390c6

The issue is that it's not possible with recent Hibernate 5.x versions to customize the unique key name on a many-to-one association with the unique-key attribute that has also a orphan delete cascading. (The upcoming attachment has a complete test case)

The following mapping ...

...causes a mapping Exception:

If the many-to-one mapping is changed to also include unique="true", the mapping exception goes away, but the specified unique key name "uk_nextid" is ignored and not used. Instead an auto-generated key name is used:

Environment

None

Activity

Show:
Gail Badner
October 11, 2016, 3:14 AM

The error message is very clear what is needed. Use the community resources for help: http://hibernate.org/community/

Gail Badner
October 11, 2016, 3:17 AM

Oops, didn't see your last comment. This is a bug.

Assignee

Unassigned

Reporter

Holger Brands

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure