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 @@ public final class BasicMetadataGenerator {
|
||||||
final Element manyToOneElement = parent.addElement( mapper != null ? "many-to-one" : "key-many-to-one" );
|
final Element manyToOneElement = parent.addElement( mapper != null ? "many-to-one" : "key-many-to-one" );
|
||||||
manyToOneElement.addAttribute( "name", propertyAuditingData.getName() );
|
manyToOneElement.addAttribute( "name", propertyAuditingData.getName() );
|
||||||
manyToOneElement.addAttribute( "class", type.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() );
|
MetadataTools.addColumns( manyToOneElement, value.getColumnIterator() );
|
||||||
|
|
||||||
// A null mapper means that we only want to add xml mappings
|
// A null mapper means that we only want to add xml mappings
|
||||||
|
|
Loading…
Reference in New Issue