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 posts
http://nhforge.org/blogs/nhibernate/archive/2009/04/09/nhibernate-mapping-lt-many-to-one-gt.aspx
see (6) and (7) to omit from database commands.
and
http://nhforge.org/blogs/nhibernate/archive/2009/04/08/nhibernate-mapping-lt-property-gt.aspx
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