Suppose I have this (simplified)
Class Cliente
Id(v => v.numero_cliente, \"numero_cliente\")
HasMany(v => v.Acionamentos).Cascade.All().LazyLoad()
Class
With the help steps you provided and some pray I solved it, adding the KeyColumn!
Id(v => v.numero_cliente, "numero_cliente")
HasMany(v => v.Acionamentos).KeyColumn("numero_cliente").Cascade.All().LazyLoad()
after adding that, then the generated HBM was changed to:
<bag cascade="all" lazy="true" name="Acionamentos" mutable="true">
<key>
<column name="numero_cliente" />
</key>
<one-to-many class="Sistema.CRM.Acionamento, Sistema, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null" />
</bag>
and no more SQL errors happened.
I am happy that I will be able to use it now! I really did not want to use EF