-
I have the following use case:
Object is an Aggregate Root and Tag a Value Object.
I'm trying to create the ClassMap using FluentNhibernate, which works well for object but I couldn't find a way to map it with Tag
Any idea how to map that an entity that has a oneToMany relation with a ValueObject from another table ? Basically I'm looking for an equivalient of It's like doing a Join on a collection where the collection does not have any identifier (basically the Pk of Tags is the combination of all the fields) I've tried: However Nhibernate when adding a Tag to the object is doing an Update instead of an insert which fails Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
ok I found the solution: |
Beta Was this translation helpful? Give feedback.
-
Note that if it's really a value object, you shouldn't really have a class mapping for it. You should only have the component mapping. |
Beta Was this translation helpful? Give feedback.
ok I found the solution:
HasMany(x => x.Tags).Component(x => { x.Map(k => k.Label); }).Table("tag");