What database were you using? We've had this reported before but when I run it against SQLite everything saves.
On Wed, Mar 25, 2009 at 3:57 AM, devSolo <[email protected]> wrote: > > I've been playing around with Fluent NHibernate tonight and I'm liking > it very much. I just thought I'd let you guys know of a small issue I > noticed while working through the FirstProject example. > > # program.cs > # 55 // save both stores, this saves everything else via > cascading > # 56 session.SaveOrUpdate(barginBasin); > # 57 session.SaveOrUpdate(superMart); > # 59 transaction.Commit(); > > I expected all 3 entities to be saved to the DB. But only the Stores > and Products actually got persisted. The sample doesn't actually save > the Employees to the db. Check the DB after a run and you will see, > or you can close the session and reopen it before the reads. > > In the constructor for StoreMap ... > > # Mappings/StoreMap.cs > #<<<<<<SNIPPIT>>>>>>> > # 8 public StoreMap() > # 9 { > # 10 Id(x => x.Id); > # 11 Map(x => x.Name); > # 12 HasManyToMany(x => x.Products) > # 13 .Cascade.All() > # 14 .WithTableName("StoreProduct"); > # 15 HasMany(x => x.Staff) > # 16 .Inverse(); > # 17 } > #<<<<<<SNIPPIT>>>>>>> > > I changed line #16 to be: > .Cascade.All().Inverse(); > > and now it is saving correctly. > > I know this is very basic thing, but the example should work as > expected. It did make me think though... and caused me to learn a bit > more about Fluent NHibernate than I would have otherwise. > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" 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/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
