FSessionFactory is null, which probably is due to a mapping error. Add a
try catch around the part where FSessionFactory is instantiated.

2017-08-12 17:32 GMT+02:00 Ganesh Gebhard <[email protected]>:

> Hi Oskar,
>
> Thanks for the advice, the message is now 'Object reference not set to an
> instance of an object.'
>
> However, I cannot figure out why this is the problem.
>
> Op zaterdag 12 augustus 2017 11:05:48 UTC+2 schreef Oskar Berggren:
>>
>> GenereicAdoException will have an InnerException property, and that in
>> turn may also have an InnerException and so on. These will often tell you
>> what the problem is.
>>
>> /Oskar
>>
>> 2017-08-11 1:44 GMT+01:00 Ganesh Gebhard <[email protected]>:
>>
>>> Sure. Everytime I want to add a new table, I get the following error:
>>>
>>> NHibernate.Exceptions.GenericADOException occurred
>>>
>>>   HResult=0x80131600
>>>
>>>   Message=could not execute query
>>>
>>> [ select dcsv0_.id as id3_, dcsv0_.fnaam as fnaam3_, dcsv0_.fvolgorde as
>>> fvolgorde3_, dcsv0_.ftype as ftype3_, dcsv0_.fglobal as fglobal3_,
>>> dcsv0_.fmachine as fmachine3_, dcsv0_.fparameter as fparameter3_ from DCSV
>>> dcsv0_ ]
>>>
>>> [SQL: select dcsv0_.id as id3_, dcsv0_.fnaam as fnaam3_,
>>> dcsv0_.fvolgorde as fvolgorde3_, dcsv0_.ftype as ftype3_, dcsv0_.fglobal as
>>> fglobal3_, dcsv0_.fmachine as fmachine3_, dcsv0_.fparameter as fparameter3_
>>> from DCSV dcsv0_]
>>>
>>>   Source=NHibernate
>>>
>>>   StackTrace:
>>>
>>>    at NHibernate.Loader.Loader.DoList(ISessionImplementor session,
>>> QueryParameters queryParameters, IResultTransformer forcedResultTransformer)
>>>
>>>    at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor
>>> session, QueryParameters queryParameters)
>>>
>>>    at NHibernate.Loader.Loader.List(ISessionImplementor session,
>>> QueryParameters queryParameters, ISet`1 querySpaces, IType[] resultTypes)
>>>
>>>    at NHibernate.Loader.Hql.QueryLoader.List(ISessionImplementor
>>> session, QueryParameters queryParameters)
>>>
>>>    at NHibernate.Hql.Ast.ANTLR.QueryTranslatorImpl.List(ISessionImplementor
>>> session, QueryParameters queryParameters)
>>>
>>>    at NHibernate.Engine.Query.HQLQueryPlan.PerformList(QueryParameters
>>> queryParameters, ISessionImplementor session, IList results)
>>>
>>>    at NHibernate.Impl.SessionImpl.List(IQueryExpression
>>> queryExpression, QueryParameters queryParameters, IList results)
>>>
>>>    at NHibernate.Impl.AbstractSessionImpl.List(IQueryExpression
>>> queryExpression, QueryParameters parameters)
>>>
>>>    at NHibernate.Impl.AbstractQueryImpl2.List()
>>>
>>>    at NHibernate.Linq.DefaultQueryProvider.ExecuteQuery(NhLinqExpression
>>> nhLinqExpression, IQuery query, NhLinqExpression nhQuery)
>>>
>>>    at NHibernate.Linq.DefaultQueryProvider.Execute(Expression
>>> expression)
>>>
>>>    at NHibernate.Linq.DefaultQueryProvider.Execute[TResult](Expression
>>> expression)
>>>
>>>    at Remotion.Linq.QueryableBase`1.GetEnumerator()
>>>
>>>    at NHDataCore.NHTable`1.<AsEnumerable>d__14.MoveNext() in
>>> E:\Documenten\Weighpack\New Database 3\OMS-Development-3718907727c4
>>> a695ff28360f4d3e9ea946495840\NHDataCore\NHDataCore\NHTable.cs:line 172
>>>
>>>    at OMS2.Model.CSVs.refresh() in E:\Documenten\Weighpack\New Database
>>> 3\OMS-Development-3718907727c4a695ff28360f4d3e9ea946495840\OMS2\Model\CSVs.cs:line
>>> 39
>>>
>>>    at OMS2.Model.CSVs..ctor(DataModel AModel) in
>>> E:\Documenten\Weighpack\New Database 3\OMS-Development-3718907727c4
>>> a695ff28360f4d3e9ea946495840\OMS2\Model\CSVs.cs:line 32
>>>
>>>    at OMS2.Model.DataModel.LoadAllData() in E:\Documenten\Weighpack\New
>>> Database 
>>> 3\OMS-Development-3718907727c4a695ff28360f4d3e9ea946495840\OMS2\Model\DataModel.cs:line
>>> 156
>>>
>>>    at OMS2.Model.DataModel..ctor() in E:\Documenten\Weighpack\New
>>> Database 
>>> 3\OMS-Development-3718907727c4a695ff28360f4d3e9ea946495840\OMS2\Model\DataModel.cs:line
>>> 128
>>>
>>>    at OMS2.MainWindow.InitializeOMS() in E:\Documenten\Weighpack\New
>>> Database 
>>> 3\OMS-Development-3718907727c4a695ff28360f4d3e9ea946495840\OMS2\MainWindow.xaml.cs:line
>>> 69
>>>
>>>    at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate
>>> callback, Object args, Int32 numArgs)
>>>
>>>    at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object
>>> source, Delegate callback, Object args, Int32 numArgs, Delegate
>>> catchHandler)
>>>
>>>
>>> The code for adding the new table in the database is:
>>>
>>>
>>> using NHDataCore;
>>>
>>> using FluentNHibernate.Mapping;
>>>
>>>
>>> namespace OMS2.Model.Entities
>>>
>>> {
>>>
>>>     public class DCSV : NHRow
>>>
>>>     {
>>>
>>>         [Indexed]
>>>
>>>
>>>         public virtual string naam { get; set; }
>>>
>>>         public virtual int volgorde { get; set; }
>>>
>>>         public virtual string type { get; set; }
>>>
>>>         public virtual string global { get; set; }
>>>
>>>         public virtual string machine { get; set; }
>>>
>>>         public virtual string parameter { get; set; }
>>>
>>>     }
>>>
>>>
>>>     public class DCSVMap : ClassMap<DCSV>
>>>
>>>     {
>>>
>>>         public DCSVMap()
>>>
>>>         {
>>>
>>>             Table("DCSV");
>>>
>>>             Cache.NonStrictReadWrite();
>>>
>>>             Id(x => x.id).GeneratedBy.Native();
>>>
>>>             Map(x => x.naam, "fnaam");
>>>
>>>             Map(x => x.volgorde, "fvolgorde");
>>>
>>>             Map(x => x.type, "ftype");
>>>
>>>             Map(x => x.global, "fglobal");
>>>
>>>             Map(x => x.machine, "fmachine");
>>>
>>>             Map(x => x.parameter, "fparameter");
>>>
>>>         }
>>>
>>>     }
>>>
>>> }
>>>
>>>
>>> When I remove everything under public class DCSVMap : ClassMap<DCSV>,
>>> the code will run. But when I add it again, the previous error occurs.
>>>
>>>
>>> I can copy the query and try to execute it in the database, but I don't
>>> know how to do that.
>>>
>>> Op donderdag 10 augustus 2017 23:55:27 UTC+2 schreef Gunnar Liljas:
>>>>
>>>> Is it an NHibernate issue?
>>>>
>>>> Can you be more specific?
>>>>
>>>> /g
>>>>
>>>> On 10 Aug 2017, at 20:03, Ganesh Gebhard <[email protected]> wrote:
>>>>
>>>> Hi,
>>>>
>>>> I tried to add a new table to the sql database, but it gives an error
>>>> no matter what I do.
>>>>
>>>> So, what are the steps to add a new table to the sql database?
>>>>
>>>> Thanks in advance.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "nhusers" group.
>>>> To unsubscribe from this group and stop receiving emails from it, send
>>>> an email to [email protected].
>>>> To post to this group, send email to [email protected].
>>>> Visit this group at https://groups.google.com/group/nhusers.
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "nhusers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/nhusers.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/nhusers.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to