Interesting. Are you using transactions? On Fri, Jun 11, 2010 at 10:16 PM, Derek Greer <dbgr...@gmail.com> wrote:
> It appears the issue was due to the session not getting flushed. > > > > > On Fri, Jun 11, 2010 at 11:57 AM, Derek Greer <dbgr...@gmail.com> wrote: > >> I'm seeing an insert for both Parent and Child, but no update to set the >> child foreign key value. >> >> >> >> On Fri, Jun 11, 2010 at 11:11 AM, James Gregory >> <jagregory....@gmail.com>wrote: >> >>> What tends to happen in uni-directional relationships is that a record >>> will be saved with a null foreign-key and then updated with the id value. Is >>> this not happening for you? or do you have a constraint that's preventing >>> this? >>> >>> On Fri, Jun 11, 2010 at 4:55 PM, Derek Greer <dbgr...@gmail.com> wrote: >>> >>>> I've just decided to try out FNH's automapping for the first time on my >>>> current project and have run into what sounds like the exact same issue as >>>> the one described >>>> here<http://groups.google.com/group/fluent-nhibernate/browse_thread/thread/696514c66a17ff5e/f03e7de7e155b36b?lnk=gst&q=inverse+automapping#f03e7de7e155b36b>. >>>> I've got a unidirectional one-to-many relationship between a Parent and >>>> Child where my Parent looks something like so: >>>> >>>> public class Parent >>>> { >>>> public virtual int Id { get; set; } >>>> public virtual IEnumerable<Child> Children { get; set; } >>>> } >>>> >>>> and my Child looks like so: >>>> >>>> public class Child >>>> { >>>> public virtual int Id { get; set; } >>>> // other properties (does not reference parent) >>>> } >>>> >>>> I'm also registering the following convention: >>>> >>>> public class HasManyConvention : IHasManyConvention >>>> { >>>> public void Apply(IOneToManyCollectionInstance instance) >>>> { >>>> instance.Key.Column(instance.EntityType.Name + "_Id"); >>>> instance.Cascade.All(); >>>> } >>>> } >>>> >>>> >>>> When creating a new Parent and adding new instances of Child to the >>>> Children collection and then saving, the Parent and Child tables are >>>> populated, but the foreign key column in the Child table is null. An issue >>>> mentioned in the referenced thread was that cascade all wasn't being used, >>>> but I've got that set. What am I missing? >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Fluent NHibernate" group. >>>> To post to this group, send email to fluent-nhibernate@googlegroups.com >>>> . >>>> To unsubscribe from this group, send email to >>>> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> >>>> . >>>> For more options, visit this group at >>>> http://groups.google.com/group/fluent-nhibernate?hl=en. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Fluent NHibernate" group. >>> To post to this group, send email to fluent-nhibern...@googlegroups.com. >>> To unsubscribe from this group, send email to >>> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> >>> . >>> For more options, visit this group at >>> http://groups.google.com/group/fluent-nhibernate?hl=en. >>> >> >> > -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To post to this group, send email to fluent-nhibern...@googlegroups.com. > To unsubscribe from this group, send email to > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. > -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.