Refresh != Reload Refresh will refresh the state of already persistent objects (one-by-one).
On Wed, Sep 1, 2010 at 2:11 PM, Rafael <[email protected]>wrote: > Hi Diego > > I tried de following solution: > > Product p = productEntity; > productEntity = null; > Session.Evict(p); > productEntity = Session.Get<Product>(p.IdProduct); > > I don't if this is the correct way to do it, but this didn't work =| > > ps: the reason I set productEntity to null is because it is a property > with the set validating for same value.. > > On 1 set, 13:03, Diego Mijelshon <[email protected]> wrote: > > Try with evict, then get > > > > Diego > > > > > > > > On Wed, Sep 1, 2010 at 10:58, Rafael <[email protected]> > wrote: > > > Hi folks, should an child entity collection be automatically updated > > > after a Save()? > > > > > I'll try to explain the problem in a sample: > > > > > Product -> CalendarGroup -> CalendarDay > > > (Many) -> (One) -> (Many) > > > > > This way, a product has a calendarGroup, and this calendarGroup has a > > > collection (Bag) of calendarDay. > > > In code, if I have a product entity, I can read some calendarDay by > > > using: myProduct.CalendarGroup.CalendarDay.First(); > > > > > The problem: that product is already loaded in memory, and, after I > > > add some day in CalendarDay using the Session, the > > > CalendarGroup.CalendarDay of that product isn't updated. > > > > > Does NHibernate have a method to update (in memory, not in database) > > > some children collection? > > > I tried the following methods: > > > > > Session.Persist(product); > > > Session.Refresh(product); > > > Session.Flush(); > > > Session.Update(product); > > > > > In all these cases, the children collection was not updated, in other > > > words, the calendarDay I added in database was not visible to that > > > product entity. > > > > > All my mapping are lazy enabled.. and if you need some code to > > > understand this problem, let me know. > > > > > Thanks. > > > > > -- > > > 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]> > <nhusers%[email protected]<nhusers%[email protected]>> > > > . > > > For more options, visit this group at > > >http://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]<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.
