Hi, i'm currently using NH 1.0 with NET 1.1
I've an M:N association that works fine, it saves and retrieves elements properly. I've added an 'OrderBy' attribute on collections's mapping that seems to generate incorrect SQL statements.
Here's the collection's mapping:
Code:
[Bag(0, Table = "PUTAssLivelliFasi", Lazy = true, Inverse = true, Cascade = CascadeStyle.SaveUpdate, OrderBy = "Codice asc")]
[Key(1, Column = "LivelloKD")]
[ManyToMany(2, ClassType = typeof(Fase), Column = "FaseKD")]
And here's the generated SQL:
Code:
... FROM PUTAssLivelliFasi fasi0_ inner join PUTFasi fase1_ on fasi0_.FaseKD=fase1_.FaseKD WHERE fasi0_.LivelloKD=@p0 ORDER BY fasi0_.Codice asc', N'@p0 int', @p0 = 2519
This statements return (correctly) the error: "Cannot find column 'Codice'". Indeed 'Codice' belongs to PUTFasi and not to PUTAssLivelliFasi.
I'm missing something in the mapping?
Thanks
Massimo