Hi
When I try mapping the following model and inserting an OpenProject I
get this error. If I make Project non-abstract it works. Anyone got
any ideas?

NHibernate.StaleObjectStateException: Row was updated or deleted by
another transaction (or unsaved-value mapping was incorrect):
[FluentNHib.Core.Domain.ClosedProject#b827aa8f-cea7-4b1a-a88b-
eff845d56861]

at NHibernate.Persister.Entity.AbstractEntityPersister.Check(Int32
rows, Object id, Int32 tableNumber, IExpectation expectation,
IDbCommand statement)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object
id, Object[] fields, Object[] oldFields, Object rowId, Boolean[]
includeProperty, Int32 j, Object oldVersion, Object obj,
SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.UpdateOrInsert
(Object id, Object[] fields, Object[] oldFields, Object rowId, Boolean
[] includeProperty, Int32 j, Object oldVersion, Object obj,
SqlCommandInfo sql, ISessionImplementor session)
at NHibernate.Persister.Entity.AbstractEntityPersister.Update(Object
id, Object[] fields, Int32[] dirtyFields, Boolean hasDirtyCollection,
Object[] oldFields, Object oldVersion, Object obj, Object rowId,
ISessionImplementor session)
at NHibernate.Action.EntityUpdateAction.Execute()
at NHibernate.Engine.ActionQueue.Execute(IExecutable executable)
at NHibernate.Engine.ActionQueue.ExecuteActions(IList list)
at NHibernate.Engine.ActionQueue.ExecuteActions()
at
NHibernate.Event.Default.AbstractFlushingEventListener.PerformExecutions
(IEventSource session)
at NHibernate.Event.Default.DefaultFlushEventListener.OnFlush
(FlushEvent event)
at NHibernate.Impl.SessionImpl.Flush()


DOMAIN OBJECTS:

    public class EntityBase
    {
        protected EntityBase()
        {
            ID = Guid.NewGuid();
        }

        public virtual Guid ID { get; set;}
        public virtual int Version { get; set; }
    }


    public abstract class Project : EntityBase
    {
    }

    public class OpenProject : Project
    {
    }

MAPPING CLASSES:

    public abstract class MappingBase<T> : ClassMap<T> where T :
EntityBase
    {
        protected MappingBase()
        {
            Id(e => e.ID).GeneratedBy.Assigned();
            Version(x => x.Version);
        }
    }

    public class ProjectMap : MappingBase<Project>
    {
        public ProjectMap()
        {
            DiscriminateSubClassesOnColumn("ProjectType")
                .SubClass<OpenProject>(MapOpenProject);
        }

        private void MapOpenProject(SubClassPart<string, Project,
OpenProject> obj)
        {
        }
    }


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" 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/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to