Skip to content

Commit 03b4c09

Browse files
committed
Fixes #11
Avoid creating a foreign key when a composite-id contains many-to-one association
1 parent ab350dc commit 03b4c09

File tree

3 files changed

+2
-1
lines changed

3 files changed

+2
-1
lines changed

Src/NHibernate.Envers/Configuration/Metadata/BasicMetadataGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ public void AddKeyManyToOne(XElement parent, PropertyAuditingData propertyAuditi
109109
MetadataTools.AddKeyManyToOne(parent, propertyAuditingData.Name, type.ReturnedClass.AssemblyQualifiedName) :
110110
MetadataTools.AddManyToOne(parent, propertyAuditingData.Name, type.ReturnedClass.AssemblyQualifiedName, true, false);
111111
MetadataTools.AddColumns(element, value.ColumnIterator.OfType<Column>());
112-
// A null mapper occurs when adding to composite-id element
113112
mapper?.Add(propertyAuditingData.GetPropertyData());
114113
}
115114
}

Src/NHibernate.Envers/Configuration/Metadata/MetadataTools.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ public static XElement AddKeyManyToOne(XElement parent, string name, string type
7474
{
7575
var manyToOneMapping = new XElement(CreateElementName("key-many-to-one"),
7676
new XAttribute("name", name),
77+
new XAttribute("foreign-key", "none"),
7778
new XAttribute("class", type));
7879
parent.Add(manyToOneMapping);
7980
return manyToOneMapping;

Src/ReleaseNotes.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
** Bug
44
* #9 More then one save in transaction with one-to-one relations throw exception
5+
* #11 Avoid creating a foreign key when a composite-id contains many-to-one association
56

67

78

0 commit comments

Comments
 (0)