0
votes

I have 3 tables that represents a many to many mapping. Two tables with different ids and a third table with a composite key referencing the other two.

How can i map this using the classmap in nhibernate?

The following doesn´t work:

HasManyToMany(m =>
                    m.ListBlockStatus)
                    .Table("BlockTypeAction")
                    .ParentKeyColumn("IdBlockActionDefinition")
                    .ChildKeyColumn("IdBlockTypeCategory")
                    .Table("BlockTypeCategory")
                    .ParentKeyColumn("Id");
1

1 Answers

1
votes

Found what i need, unfortunately the query in the end is not an inner join.

            HasManyToMany(m => m.ListBlockStatus)
            .Table("BlockTypeAction")
            .ChildKeyColumns.Add("IdBlockActionDefinition")
            .ParentKeyColumn("IdBlockTypeCategory")
            .Cascade.All();