My suggestion was to map only the ID of B like a property inside the A class. This works for shure in NHiberbate because I did that in my projects.
If you are talking about a doulble mapping of the same property inside the same mapping file that works too if you clearly specify that the flags INSERT and UPDATE to be false on the second time you are mapping the same property.
In order to see, that I use that and it works, I give you an example of my mapping from one of my project:
Code:
<class>
<composite-id name="PK_S_Produttore" class="E_ProduttoreKey" unsaved-value="any" access="property">
<key-property name="Codice" type="System.Int32" column="CodProduttore" />
<key-many-to-one name="Cliente" class="Cliente">
<column name="CodCliente" />
</key-many-to-one>
</composite-id>
<property name="CodProduttore" type="System.Int32" column="CodProduttore" not-null="true" insert="false" update="false"/>
<property name="CodCliente" type="System.Int16" column="CodCliente" not-null="true" insert="false" update="false" />
.........................................................................................................
<property name="CodTipoProduttore" type="System.Int16" column="CodTipoProduttore" not-null="false"/>
</class>
So you can see at the end how I map the
TipoProduttore that is a reference to another table.
And you can also see how I map
CodProduttore and
CodCliente twice in the same mapping file.
Maybe you didn't understand my suggestion on how to solve the problem in the first place but what I said works just fine.