That mean that is you do first ISession... and then Element ... and then ISession ... there is a possibility that the collection... will be associated with ... sessions.
On Mon, Jul 19, 2010 at 5:35 AM, Giulio Petrucci <[email protected]>wrote: > Hi there, > > I've been lurking this mailing list for a while and this is my first post. > :-) > My model is a matrix, like this: > > class Matrix { > IEnumerable <Column> ColumnSet { get; } > IEnumerable <Row> RowSet { get; } > void AddColumn(Column c); > void AddRow(Row r); > } > > class Column > { > Matrix Matrix { ... } > } > > class Row > { > Matrix Matrix { ... } > IEnumerable<Element> ElementSet { get; } > } > > class Element { > Int32 Value { get; } > Row Row { get; } > Column Column { get; } > } > > Every class has an Id property, whici is of Guid type. > When I add a Column (AddColumn() method), automatically a new Element > is added for each Row in the RowSet. > When I add a Row (AddRow() method), automatically an element for each > Column in the ColumnSet si added to the Row I'm adding. > In the mapping files, for Matrix/Column/Row/Element I've set: > cascade="all-delete-orphan". I need to handle one session only to > read data in their actual persistent state (in a sort of db polling): > > Guid id = ...; > ISessionFactory sf = ...; > using (ISession sf.OpenSession()) > { > Element e = s.Get<Element>(id); > //something here; > } > > ..and another session to rea/write data: > > int newValue = ...; > ISession s = ...; > Element r = ...; > > using (ITransaction tx = s.BeginTransaction()) > { > e.Value = newValue; > s.SaveOrUpdate(e); > tx.Commit(); > } > > and here I get an "Illegal attempt to associate a collection with two > open sessions". > As I'm quite a newbie, my my questions are: > 1. What does it mean? ;-) > 2. How can I fix it? > > Thanks in advance. Have a nice day/week, > Giulio > > -- > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
