Illegal attempt to associate a collection with two open sessions.
2009/6/26 ian <[email protected]>

>
> I'm getting an illegal attempt error when updating. I have a TruckLoad
> class that has TruckLoadItem class. This is my mapping
>
> <?xml version="1.0" encoding="utf-8" ?>
> <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
>    namespace="Bogetz.Elephant.Model" assembly="elephant">
>
>    <class name="TruckLoad" table="truck_loads">
>        <id name="Id">
>                <generator class="native"/>
>        </id>
>                <property name="Date"/>
>                <many-to-one name="Route" class="Route" column="RouteId"/>
>                <many-to-one name="Salesman" class="Salesman"
> column="SalesmanId"/>
>                <property name="TruckNo"/>
>                <property name="PreparedBy"/>
>                <property name="ApprovedBy"/>
>                <property name="ReleasedBy"/>
>                <property name="RecordedBy"/>
>                <bag name="Items" cascade="all">
>                <key column="TLId"/>
>                <one-to-many class="TruckLoadItem"/>
>        </bag>
>    </class>
>
>        <class name="TruckLoadItem" table="truck_load_items">
>        <id name="Id">
>                <generator class="native"/>
>        </id>
>        <many-to-one name="Load" class="TruckLoad" column="TLId"/>
>                <many-to-one name="Item" class="Item" column="ItemId"/>
>                <property name="Quantity"/>
>                <property name="UnitPrice"/>
>    <property name="Amount"/>
>    </class>
>
> </hibernate-mapping>
>
> This happens when I call return NHibernateHelper.OpenSession
> ().CreateCriteria(typeof(TruckLoad)).List<TruckLoad>(); and populate
> the list into a listview. When double clicked, I get the
>
> TruckLoad t = (Model as List<TruckLoad>)[listView1.SelectedItems
> [0].Index];
>
> and feed it to TruckLoadForm, when I do SaveOrUpdate(TruckLoad), I get
> the error. I'm kinda lost to where I can find the solution. Please
> help, thanks a lot.
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
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