What is the proper way to bulk insert entities which contain collections of other entities (a HasMany
mapping), using stateless sessions?
E.g. Parent class is mapped like this:
class ParentMap : ClassMap<Parent>
{
public ParentMap()
{
Id(x => x.Id)
.GeneratedBy.Increment();
HasMany(x => x.ChildNodes)
.KeyColumns.Add("Parent_id")
.Cascade.All();
}
}
Stateless session ignores the Cascade option, so child nodes are not persisted automatically. I could iterate through the collection myself, but then I cannot set the relation, because Parent_id
column does not exist as a property I could write to.
Am I missing something?