Hi,
nh, somewhere close to the trunk.
I have a table per subclass inheritance mapping.
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="ShoppingCartItem"
table="ShoppingCartItem"
lazy="true">
<id name="Id"
column="ShoppingCartItemID"
unsaved-value="0">
<generator class="identity" />
</id>
<many-to-one name="Cart"
column="ShoppingCartID"
not-null="true"
class="ShoppingCart"/>
<joined-subclass name="ShoppingCartProductItem"
table="ShoppingCartProductItem">
<key column="ShoppingCartItemID"/>
<many-to-one name="Product"
column="ProductID"
not-null="false"
class="Product"
cascade="none"/>
<property name="Option"
column="[Option]" />
</joined-subclass>
<joined-subclass name="ShoppingCartProductSetItem"
table="ShoppingCartProductSetItem">
<key column="ShoppingCartItemID"/>
<many-to-one name="ProductSet"
column="ProductSetID"
not-null="false"
class="ProductSet"
cascade="none"/>
</joined-subclass>
</class>
</hibernate-mapping>
I get lots of 'Invalid column name 'ShoppingCartID'.' exceptions, because NH looks for this column in the wrong table.... The generated sql is like this:
Code:
SELECT productite0_.ShoppingCartID AS Shopping4_1_, productite0_.ShoppingCartItemID AS Shopping1_1_, productite0_.ShoppingCartItemID AS Shopping1_39_0_,
productite0_1_.ShoppingCartID AS Shopping5_39_0_, productite0_.ProductID AS ProductID40_0_
FROM ShoppingCartProductItem AS productite0_ INNER JOIN
ShoppingCartItem AS productite0_1_ ON productite0_.ShoppingCartItemID = productite0_1_.ShoppingCartItemID
WHERE (productite0_.ShoppingCartID = '9c8692bb-d829-4d89-94e7-9a5b00c4fd7d')
so it looks for the ShoppingCardId in the table productite0_, where it actually should look in productite0_1_. At least it seems to me that this is what I am telling NH to do.
Any help greatly appreciated!
Jan