Hi,

  Sorry this is probably a dumb question.  I've just started playing with
FluentNH and not really an NH user other than Castle ActiveRecord.  If I
setup up the mapping and run, it creates everything fine use SchemaExport.
 But if I add a column to the mapping and use SchemaUpdate, I get a no
column error:

Exception
NHibernate.Exceptions.GenericADOException: could not insert:
[FluentNHibIntro.Entities.WebLink][SQL: INSERT INTO "WebLink" (URL, Name,
OpenNewWindow) VALUES (?, ?, ?); select last_insert_rowid()] --->
System.Data.SQLite.SQLiteException: SQLite error
 table WebLink has no column named OpenNewWindow

  Surely I'm doing something wrong but don't know where to begin.  Being
this is just a side project/self-education, I have little time to mess
around.  I would appreciate any help; even if just to point me where to look
or debug.  I'll paste the FluentNH mapping & setup related info below
because it's probably relevant.

Thanks,
-j

Josh | josh [at] computeristsolutions [dot] com |
http://computeristsolutions.com
http://www.linkedin.com/in/joshuacoffman | http://twitter.com/csinc

//setup
        public ISessionFactory CreateSessionFactory()
        {
            if (_sessionFactory == null)
            {
                _sessionFactory = Fluently.Configure()
                    .Database(SQLiteConfiguration.Standard
                        .UsingFile(DbFile))
                    .Mappings(m =>
                        m.FluentMappings.AddFromAssemblyOf<BootStrap>())
                    .ExposeConfiguration(BuildSchema)
                    .BuildSessionFactory();
            }

            return _sessionFactory;
        }

        /// <summary>
        /// this is where we manage database schema and versioning; still
working on how to handle versioning.
        /// </summary>
        /// <param name="config"></param>
        private void BuildSchema(Configuration config)
        {
            if (File.Exists(DbFile))
                new SchemaUpdate(config).Execute(false, true);
            else
                new SchemaExport(config).Create(false, true);
        }

//mapping related

    public class WebLink
    {
        public virtual int Id { get; private set; }
        public virtual string URL { get; set; }
        public virtual string Name { get; set; }
        public virtual bool OpenNewWindow { get; set; }
    }

    public class WebLinkMap : ClassMap<WebLink>
    {
        public WebLinkMap()
        {
            Id(x => x.Id);
            Map(x => x.URL);
            Map(x => x.Name);
            Map(x => x.OpenNewWindow);
        }
    }

--~--~---------~--~----~------------~-------~--~----~
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