Hi Jason, first of all, thank you for your reply.
On Tue, Nov 16, 2010 at 6:55 PM, Jason Meckley <[email protected]> wrote: > where is the transaction? NH requires all reads and writes are wrapped > within a transaction. I see. Anyway, I tried some further test and got this "strange" behaviour (well, maybe its sounds strange only for my noob ears :-)). Here are my classes: public class GTransient //G stands for Guid { public virtual Guid Id { get; set; } public virtual string Label { get; set; } } public class LTransient //L stands for long { public virtual Int64 Id { get; set; } public virtual string Label { get; set; } } and here are their mappings: <class name="GTransient" table="GTransient"> <id column="Id" name="Id"> <generator class="guid"/> </id> <property name="Label" column="Label"/> </class> <class name="LTransient" table="LTransient"> <id column="Id" name="Id"> <generator class="identity"/> </id> <property name="Label" column="Label"/> </class> rtunning this snipped: ISession s = sf.OpenSession(); var l = new LTransient() { Label = "L" }; s.Save(l); //INSERT statement!!! var g = new GTransient() { Label = "G" }; s.Save(g); //nothing Console.WriteLine("gList.Count: " + s.Query<GTransient>().Count()); // = 0 Console.WriteLine("lList.Count: " + s.Query<LTransient>().Count()); // = 1 s.Flush(); Console.WriteLine("gList.Count: " + s.Query<GTransient>().Count()); // = 1 Console.WriteLine("lList.Count: " + s.Query<LTransient>().Count()); // = 0 the first time on s.Save(l) an INSERT statement is generated and executed, while nothing happens on s.Save(g). Setting s.FlushMode to 'Never' the INSERT statement for 'l' is executed right before the first s.Query<LTransient>() statement. So, my questions are: 1. Whi the INSERT statement is executed for 'l' and not for 'g''? 2. How can I prevent this behaviour, so that I can test a query on transient objects (even not working) with LTransient objects? Thank you in advance, 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]. For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
