I'm getting an an exception of: "Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TestValue]" when I try and delete an object.
I'm using SQL Server 2005 Express and I can insert, query and delete by hql; however, when I try and call Session.Delete on an instance of an object I query for I get the following exception and stack trace: Exception of type 'Antlr.Runtime.NoViableAltException' was thrown. [TestValue] at NHibernate.Hql.Ast.ANTLR.ErrorCounter.ThrowQueryException() at NHibernate.Hql.Ast.ANTLR.HqlParseEngine.Parse() at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Parse(Boolean isFilter) at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.DoCompile(IDictionary`2 replacements, Boolean shallow, String collectionRole) at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.Compile(IDictionary`2 replacements, Boolean shallow) at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, String collectionRole, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) at NHibernate.Engine.Query.HQLQueryPlan..ctor(String hql, Boolean shallow, IDictionary`2 enabledFilters, ISessionFactoryImplementor factory) at NHibernate.Engine.Query.QueryPlanCache.GetHQLQueryPlan(String queryString, Boolean shallow, IDictionary`2 enabledFilters) at NHibernate.Impl.AbstractSessionImpl.GetHQLQueryPlan(String query, Boolean shallow) at NHibernate.Impl.SessionImpl.List(String query, QueryParameters queryParameters, IList results) at NHibernate.Impl.SessionImpl.List(String query, QueryParameters parameters) at NHibernate.Impl.SessionImpl.Find(String query, Object[] values, IType[] types) at NHibernate.Impl.SessionImpl.Delete(String query, Object[] values, IType[] types) at NHibernate.Impl.SessionImpl.Delete(String query) at OPEN.Fluent.Test.Entry.Main() in E:\Open\OPEN.Fluent.Test \Entry.cs:line 21 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() Here's the sql to dreate the table: CREATE TABLE [Entity].[SitewideVariables]( [SitewideVariableID] [int] IDENTITY(1,1) NOT NULL, [Name] [varchar](50) NOT NULL, [Value] [varchar](50) NOT NULL, [LastModifiedDate] [smalldatetime] NOT NULL, [LastModifiedBy] [int] NOT NULL, CONSTRAINT [PK_SitewideVariables] PRIMARY KEY CLUSTERED ( [SitewideVariableID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY], CONSTRAINT [IX_SitewideVariables] UNIQUE NONCLUSTERED ( [Name] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] GO SET ANSI_PADDING OFF GO ALTER TABLE [Entity].[SitewideVariables] ADD CONSTRAINT [DF_SitewideVariables_LastModifiedDate] DEFAULT (getdate()) FOR [LastModifiedDate] GO Here's the config I'm using: public class FluentFactory { private static ISessionFactory sessionFactory; public static ISessionFactory SessionFactory { get { if (sessionFactory == null) sessionFactory = CreateSessionFactory(); return sessionFactory; } } private static ISessionFactory CreateSessionFactory() { return Fluently.Configure() .Database(MsSqlConfiguration.MsSql2005.ConnectionString(c => c.FromAppSetting(Constants.OpenConnection)) .Cache(c => c.UseQueryCache().UseMinimalPuts()).ShowSql().FormatSql()) .Mappings(m => m.FluentMappings.AddFromAssemblyOf<FluentFactory>()).BuildSessionFactory(); } } Here's the class, mapping and a test to recreate the exception: public abstract class BusinessClass { protected BusinessClass() { InstanceId = Guid.NewGuid().ToString(); } public virtual object Tag { get; set; } public virtual int Id { get; set; } public virtual Guid Guid { get; set; } public virtual string InstanceId { get; private set; } public virtual int LastModifiedBy { get; set; } } public class SitewideVariable : BusinessClass { public virtual string Name { get; set; } public virtual string Value { get; set; } public static implicit operator string(SitewideVariable sv) { return sv.Value; } } public class SitewideVariableMap : ClassMap<SitewideVariable> { public SitewideVariableMap() { Table("[Entity].[SitewideVariables]"); Id(x => x.Id, "SitewideVariableID"); Map(x => x.LastModifiedBy, "LastModifiedBy"); Map(x => x.Name, "Name"); Map(x => x.Value, "Value"); } } public static void Main() { var session = FluentFactory.SessionFactory.OpenSession(); new PersistenceSpecification<SitewideVariable>(session) .CheckProperty(c => c.Name, "TestVariable") .CheckProperty(c => c.Value, "TestValue") .CheckProperty(c => c.LastModifiedBy, 103420) .VerifyTheMappings(); var results = session.CreateCriteria(typeof(SitewideVariable)) .Add(Expression.Eq("Name", "TestVariable")).List<SitewideVariable>(); Assert.AreEqual(results.Count, 1); session.Delete(results[0]); session.Flush(); results = session.CreateCriteria(typeof(SitewideVariable)) .Add(Expression.Eq("Name", "TestVariable")).List<SitewideVariable>(); Assert.AreEqual(results.Count, 0); session.Flush(); session.Close(); } I get the stack trace on "session.Delete(results[0]);". I've been trying to figure this out all day and I'm not having any luck. I hope someone can help. Cheers, Lorentz -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@googlegroups.com. To unsubscribe from this group, send email to fluent-nhibernate+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en.