NHibernate.MappingException: None

I have a problem updating with a stateless session, and I wonder if anyone has seen this. (NHibernate 3.1).

I basically do the following:

SomeEntity e = statelessSession.Get<SomeEntity>(id); e.SomeProperty = "a new value"; statelessSession.Update(e); 

and I get the following error:

 NHibernate.MappingException: No persister for: Castle.Proxies.SomeEntityProxy at NHibernate.Impl.SessionFactoryImpl.GetEntityPersister(String entityName) at NHibernate.Impl.StatelessSessionImpl.GetEntityPersister(String entityName, Object obj) at NHibernate.Impl.StatelessSessionImpl.Update(String entityName, Object entity) at NHibernate.Impl.StatelessSessionImpl.Update(Object entity) 

Display -

 class SomeEntityMap : ClassMap<SomeEntity> { public SomeEntityMap() { Table("Some_Entity"); Id(x => x.ID).Column("ID"); Map(x => x.Name).Column("NAME"); } 

I went through the debugger and see that statelessSession.Get (id) returns me a proxy. Is it true?

Does anyone know what the problem is? Please share your opinion and suggestion.

+4
source share
1 answer

I completed a test project, as you described in your question, and could not reproduce the problem. The only scenarios that I could reproduce were:

  • The location of the mappings was not specified during the initialization of the factory session, i.e. you are absent

     Fluently.Configure() .Mappings(m => m.FluentMappings.AddFromAssemblyOf<SomeEntity>()); 
  • One of SomeEntity properties SomeEntity marked as lazy="no-proxy" . More information can be found here .

+1
source

All Articles