I discovered the problem:
The OrderItem had a property called "ProductType" and in the Any
(TypeColumn) mapping I used another column, also called "ProductType".
So NH tried to add 2 columns called ProductType to the sql.
I removed the property ProductType, since i had the same value as the
column ProductType and i solved the problem.

Thanks cws for pointing where to look :)

On Apr 28, 9:45 am, bdaniel7 <[email protected]> wrote:
> My model is pretty much like the one described by Ayende in the "<any/>" post
>
> (http://nhforge.org/blogs/nhibernate/archive/2009/04/21/nhibernate-
> mapping-lt-any-gt.aspx)
>
> In OrderItem I have an IPricedModel and mapping to several classes,
> which implement the IPricedModel.
> The difference is that those classes also inherit from a generic base
> class, which I use to persist the common properties (4 + PK).
>
> Model.Color : PricedModel<Color>, IPricedModel
> and
> PricedModel<T> : PersistentValidationModel <T> :
> ActiveRecordValidationBase<T>
>
> I still can't figure out what property is the the guilty one, the NH
> log doesn't show it.
>
> On Apr 27, 6:47 pm, cws <[email protected]> wrote:
>
> > Hi!
>
> > I think there are three:
>
> > 1: using dynamic update and insert and don't set both properties
> > especially not to different values.
>
> > 2:See this nice blog 
> > postshttp://nhforge.org/blogs/nhibernate/archive/2009/04/09/nhibernate-map...
> > see (6) and (7) to omit from database commands.
> > andhttp://nhforge.org/blogs/nhibernate/archive/2009/04/08/nhibernate-map...
> > see (4)
>
> > Here you also can learn exactly what is happening with diffrent kind
> > of mappings.
>
> > 3:Drop the mapping for many-to-one or property to just have on mapping
> > for the column.
>
> > On 27 Apr, 14:01, bdaniel7 <[email protected]> wrote:
>
> > > And is there a solution for this?
>
> > > On Apr 26, 10:39 pm, cws <[email protected]> wrote:
>
> > > > Hello!
>
> > > > Little hard to read the mappings, but I encountered kind of same.
>
> > > > With this mapping:
>
> > > > <class name="BlockKurskatalog" dynamic-insert="true" dynamic-
> > > > update="true" >
> > > >     <id name="ID" column="collection_index" type="Int32" >
> > > >         <generator class="hilo"/>
> > > >     </id>
> > > >     <property name="BlockId" not-null="true" />
> > > >     <property name="KurskatalogId" not-null="true" />
> > > >     <many-to-one name="Block" column="Block_id" class="Block"
> > > > cascade="save-update"/>
> > > >     <many-to-one name="Kurskatalog" column="Kurskatalog_id"
> > > > class="Kurskatalog" cascade="save-update"/>
> > > >  </class>
>
> > > > So doing like this
>
> > > > So when having a object of this type associated with the session and
> > > > setting one of the many-to-one properties and the same property mapped
> > > > to the same column produced the
> > > > same error as you encountered,
>
> > > > Hope this is helpful.
>
> > > > On 24 Apr, 14:33, bdaniel7 <[email protected]> wrote:
>
> > > > > i couldn't attach files so i posted them here
>
> > > > > <?xml version="1.0" encoding="utf-16"?>
> > > > > <hibernate-mapping  auto-import="true" default-lazy="false"
> > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> > > > > xmlns="urn:nhibernate-
> > > > > mapping-2.2">
> > > > >   <class name="Veranda.Online.Model.Order, Veranda.Online.Model"
> > > > > table="Orders" dynamic-update="true" dynamic-insert="true"
> > > > > lazy="true">
> > > > >     <id name="Id" access="nosetter.camelcase" column="Id" type="Int32"
> > > > > unsaved-value="0">
> > > > >       <generator class="identity">
> > > > >       </generator>
> > > > >     </id>
> > > > >     <property name="ShippedDate" access="property"
> > > > > type="System.DateTime, mscorlib, Version=2.0.0.0, Culture=neutral,
> > > > > PublicKeyToken=b77a5c561934e089">
> > > > >       <column name="ShippedDate"/>
> > > > >     </property>
> > > > >     <property name="Price" access="property" type="Double">
> > > > >       <column name="Price"/>
> > > > >     </property>
> > > > >     <property name="PurchasedDate" access="property"
> > > > > type="System.DateTime">
> > > > >       <column name="PurchasedDate"/>
> > > > >     </property>
> > > > >     <many-to-one name="Buyer" access="property"
> > > > > class="Veranda.Online.Model.User, Veranda.Online.Model"
> > > > > column="Buyer" />
> > > > >     <bag name="Items" access="property" table="OrderItems"
> > > > > lazy="false" inverse="true" cascade="all-delete-orphan">
> > > > >       <key column="[Order]" />
> > > > >       <one-to-many class="Veranda.Online.Model.OrderItem,
> > > > > Veranda.Online.Model" />
> > > > >     </bag>
> > > > >   </class>
> > > > > </hibernate-mapping>
>
> > > > > <?xml version="1.0" encoding="utf-16"?>
> > > > > <hibernate-mapping  auto-import="true" default-lazy="false"
> > > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
> > > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
> > > > > xmlns="urn:nhibernate-
> > > > > mapping-2.2">
> > > > >   <class name="Veranda.Online.Model.OrderItem, Veranda.Online.Model"
> > > > > table="OrderItems" dynamic-update="true" dynamic-insert="true"
> > > > > lazy="true">
> > > > >     <id name="Id" access="nosetter.camelcase" column="Id" type="Int32"
> > > > > unsaved-value="0">
> > > > >       <generator class="identity">
> > > > >       </generator>
> > > > >     </id>
> > > > >     <property name="Price" access="property" type="Double">
> > > > >       <column name="Price"/>
> > > > >     </property>
> > > > >     <property name="ProductType" access="property">
> > > > >       <column name="ProductType"/>
> > > > >     </property>
> > > > >     <property name="Quantity" access="property" type="Int32">
> > > > >       <column name="Quantity"/>
> > > > >     </property>
> > > > >     <any name="Product" access="property" id-type="Int32" meta-
> > > > > type="Int32">
> > > > >       <meta-value value="0" class="Veranda.Online.Model.Color,
> > > > > Veranda.Online.Model" />
> > > > >       <meta-value value="1" class="Veranda.Online.Model.VerandaSize,
> > > > > Veranda.Online.Model" />
> > > > >       <meta-value value="5" class="Veranda.Online.Model.WindScreen,
> > > > > Veranda.Online.Model" />
> > > > >       <meta-value value="2" class="Veranda.Online.Model.RoofPlate,
> > > > > Veranda.Online.Model" />
> > > > >       <meta-value value="3" class="Veranda.Online.Model.Pillar,
> > > > > Veranda.Online.Model" />
> > > > >       <meta-value value="4" class="Veranda.Online.Model.SideFrame,
> > > > > Veranda.Online.Model" />
> > > > >       <column name="ProductType" />
> > > > >       <column name="ProductID" />
> > > > >     </any>
> > > > >     <many-to-one name="Order" access="property"
> > > > > class="Veranda.Online.Model.Order, Veranda.Online.Model"
> > > > > column="[Order]" />
> > > > >   </class>
> > > > > </hibernate-mapping>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to