mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-18 00:55:16 +00:00
HHH-11107 - Avoid creating a foreign key when a composite-id contains a many-to-one association for the envers schema.
This commit is contained in:
parent
501a1f4f9b
commit
68eb34960b
@ -126,6 +126,14 @@ boolean addManyToOne(
|
||||
final Element manyToOneElement = parent.addElement( mapper != null ? "many-to-one" : "key-many-to-one" );
|
||||
manyToOneElement.addAttribute( "name", propertyAuditingData.getName() );
|
||||
manyToOneElement.addAttribute( "class", type.getName() );
|
||||
|
||||
// HHH-11107
|
||||
// Use FK hbm magic value 'none' to skip making foreign key constraints between the Envers
|
||||
// schema and the base table schema when a @ManyToOne is present in an identifier.
|
||||
if ( mapper == null ) {
|
||||
manyToOneElement.addAttribute( "foreign-key", "none" );
|
||||
}
|
||||
|
||||
MetadataTools.addColumns( manyToOneElement, value.getColumnIterator() );
|
||||
|
||||
// A null mapper means that we only want to add xml mappings
|
||||
|
Loading…
x
Reference in New Issue
Block a user