Thanks, that partially works. Unfortunately, when I call these instead
of Refresh, Session.IsDirty() always returns true afterwards. Even
when the entity I refresh was the only one changed. I needed to
replace Evict with Clear in order to get the session clean again. Is
this expected behaviour? I would find it more logical if an evict
could also set a session back to it's clean state again.


On Jan 31, 2:31 pm, Fabio Maulo <[email protected]> wrote:
> As workaround :
> session.Evict(entity);
> session.Get<TEntity>(id);
>
> 2010/1/31 Maximilian Csuk <[email protected]>
>
>
>
> > Thanks!
>
> > Is there a bugtracker where I can monitor this issue? What would you
> > suggest as a work-around? For added entities, I could loop through the
> > collection and remove all which have no DB-identifier. But for remoed
> > entities?
>
> > Regards,
>
> > On 30 Jan., 17:51, Fabio Maulo <[email protected]> wrote:
> > > I think we having a opened issue about this matter.
>
> > > 2010/1/30 Maximilian Csuk <[email protected]>
>
> > > > Hi there,
>
> > > > I am trying to use Session.Refresh() to rollback changes made to an
> > > > entity in memory. The entity has a lazy loaded one-to-many association/
> > > > collection to other entities (cascade is all-delete-orphans).
>
> > > > When I add an entity to the collection and call Refresh(), it gives me
> > > > this NHibernate exception:
> > > > this instance does not yet exist as a row in the database
>
> > > > As I see it, "instance" refers to the added entity, which is obviously
> > > > not persistent in the database. However, I read here (http://
> > > > groups.google.com/group/nhibernate-development/browse_thread/thread/
> > > > 53aa292a0e451c4d?fwc=1), that refreshing also works on associations.
> > > > Is that not true for added (or removed) entities?
>
> > > > Is Refresh even the right tool for the job?
>
> > > > Thanks for your time.
>
> > > > --
> > > > 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.
>
> > > --
> > > 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]<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.

Reply via email to