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 nhu...@googlegroups.com.
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/nhusers?hl=en.
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 <fabioma...@gmail.com> wrote:
> I think we having a opened issue about this matter.
>
> 2010/1/30 Maximilian Csuk <maximilian.c...@gmx.at>
>
>
>
> > 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 nhu...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > nhusers+u...@googlegroups.com<nhusers%2Bunsu...@googlegroups.com>
To unsubscribe from this group, send email to nhusers+u...@googlegroups.com.
On Jan 31, 2:31 pm, Fabio Maulo <fabioma...@gmail.com> wrote:
> As workaround :
> session.Evict(entity);
> session.Get<TEntity>(id);
>
> 2010/1/31 Maximilian Csuk <maximilian.c...@gmx.at>
> > <nhusers%2Bunsu...@googlegroups.com<nhusers%252Buns...@googlegroups.com>