Perfect. Now I know. I thought maybe there was some magic that could be done with transactions or locking or guid.comb. Thank you so much!
On Apr 27, 5:14 pm, Ramon Smits <[email protected]> wrote: > It starts on the database level. How can one record be added when the > other is not inserted yet? There is a chicken/egg problem here that > NHibernate cannot solve for you. It would result in referential > integrety problems when only one record would got inserted. > > On 27 apr, 22:56, nicklang <[email protected]> wrote: > > > > > > > Also, here are the Fluent NHibernate mappings: > > > public class Tester1Map : ClassMap<Tester1> > > { > > public Tester1Map() > > { > > Id(x => x.Tester1Id) > > .GeneratedBy.GuidComb(); > > Map(x => x.Name); > > References<Tester2>(x => x.Tester2) > > .Column("Tester2Id") > > .Cascade.SaveUpdate() > > .Not.Nullable(); > > } > > > } > > > public class Tester2Map : ClassMap<Tester2> > > { > > public Tester2Map() > > { > > Id(x => x.Tester2Id) > > .GeneratedBy.GuidComb(); > > Map(x => x.Name); > > References<Tester1>(x => x.Tester1) > > .Column("Tester1Id") > > .Cascade.SaveUpdate() > > .Not.Nullable(); > > } > > > } > > > Thanks for any inside you may have! > > > On Apr 27, 4:36 pm, nicklang <[email protected]> wrote: > > > > Hi, > > > > I have 2 entities, each referencing each other (cyclical dependency) > > > via many-to-one relationships (I'm using FluentNHibernate so they are > > > actually References calls) > > > > Now what I'm trying to do is: > > > > Tester1 tester1 = new Tester1(); > > > tester1.Name = "the tester1"; > > > > Tester2 tester2 = new Tester2(); > > > tester2.Name = "the tester2"; > > > > tester1.Tester2 = tester2; > > > tester2.Tester1 = tester1; > > > > session.Save(tester1); > > > > The error I keep getting is on the last line: > > > > NHibernate.PropertyValueException: not-null property references a null > > > or transient value DataTransfer.Tester.Tester2. > > > > I'm using Guid.Comb for my Ids. > > > > I thought NHibernate worked out these details - I'm clearly missing a > > > big piece of the puzzle! > > > > Any ideas why this doesn't work? > > > > -- > > > 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 > > > athttp://groups.google.com/group/nhusers?hl=en. > > > -- > > 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 > > athttp://groups.google.com/group/nhusers?hl=en. > > -- > 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 > athttp://groups.google.com/group/nhusers?hl=en. -- 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.
