Yes.
the other option, perhaps even more easy and generic is
var e = session.Load<T>(id);
session.Delete(e);

2009/11/21 epitka <[email protected]>

> So, if I understand it correctly it is equivalent to
>
> var o = Session.Get<MetaProject>(_metaProjectId);
>  Session.Delete(o);
>
>
> On Nov 21, 8:37 am, Fabio Maulo <[email protected]> wrote:
> > and it will load the entity
> > session.CreateQuery("delete from YourEntity y where y.Id =
> > :pId)").SetInt32("pId", 5).ExecuteUpdate();
> > will NOT load the entity (and does not work with cascade)
> >
> > 2009/11/21 epitka <[email protected]>
> >
> >
> >
> >
> >
> > > Ah, nevermind, it seems to require qualified name.
> >
> > > On Nov 21, 8:05 am, epitka <[email protected]> wrote:
> > > > There is a Delete overload that accepts EntityName and Id. But was is
> > > > this EntityName? Is it name of the class or what? I am asking because
> > > > if I do Session.Delete("MetaProject", id) i get an error
> >
> > > > NHibernate.MappingException: No persister for: MetaProject
> > > > at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String
> > > > entityName)
> > > > at NHibernate.Impl.SessionImpl.GetEntityPersister(String entityName,
> > > > Object obj)
> > > > at NHibernate.Event.Default.DefaultDeleteEventListener.OnDelete
> > > > (DeleteEvent event, ISet transientEntities)
> > > > at NHibernate.Event.Default.DefaultDeleteEventListener.OnDelete
> > > > (DeleteEvent event)
> > > > at NHibernate.Impl.SessionImpl.FireDelete(DeleteEvent event)
> > > > at NHibernate.Impl.SessionImpl.Delete(String entityName, Object obj)
> > > > at
> >
> > >
> dnnSphere.MetaTests.PersistenceSpecificationTests.MetaProjectTest.TearDown
> > > > () in MetaProjectTest.cs: line 127
> >
> > > --
> >
> > > 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=.
> >
> > --
> > 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=.
>
>
>


-- 
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=.


Reply via email to