ошибка nhibernate

у меня есть этот этот код:

using System;
using System.Collections.Generic;
using System.Text;
using NHibernate;
using NHibernate.Cfg;
using base_donnee;
using System.IO;

namespace TrackingUnitSimulator
{ 
    public class connection
    {
        public  ISession session ;
        public IList<simulateur> simulateurs = null;
        public IList<user> users = null;
        public IList<equipment> equipments = null;
        public IList<string> jours = null;
        public IList<int> conn_1 = null;
        public IList<int> recep_1 = null;
        public IList<int> envoi_1 = null;
        public IList<int> conn_tout = null;
        public IList<int> recep_tout = null;
        public IList<int> envoi_tout = null;
        public IList<Performance> performances = null;
        public int[] mesures = new int[100];
        public IList<int> nombres = null;
          public connection()
        {
           ISessionFactory factory;
            Configuration config = new Configuration();
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionProvider, "NHibernate.Connection.DriverConnectionProvider");
            config.SetProperty(NHibernate.Cfg.Environment.Dialect, "NHibernate.Dialect.MsSql2005Dialect");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionDriver, "NHibernate.Driver.SqlClientDriver");
            config.SetProperty(NHibernate.Cfg.Environment.ConnectionString, "Data Source=HP-PC\\SQLEXPRESS;Initial Catalog=Simulation;Integrated Security=True;Pooling=False");
            config.SetProperty(NHibernate.Cfg.Environment.ProxyFactoryFactoryClass, "NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle");

                config.AddAssembly("base_donnee");



            factory = config.BuildSessionFactory();

            try
            {
                session = factory.OpenSession();

                try
                {
                simulateurs = session.CreateQuery(@"select e from  simulateur e ordred by e.Date").List<simulateur>();

                    users = session.CreateQuery(@"select e from user e ").List<user>();
                }
                catch (Exception ex) { File.AppendAllText(@"C:\Users\HP\Desktop\test.txt",ex.ToString());}
                equipments = session.CreateQuery(@"select e from  equipment e ").List<equipment>();
                performances = session.CreateQuery(@"select e from Performance e ").List<Performance>();
                jours = session.CreateQuery(@"select distinct e.Date from simulateur e ordred by e.Date").List<string>();
                nombres = session.CreateQuery(@"select e.Nombre_simulateur from simulateur e ordred by e.Date").List<int>();
                conn_1 = session.CreateQuery(@"select  e.temps_connection from simulateur e where e.Nombre_simulateur = 1 ").List<int>();
                recep_1 = session.CreateQuery(@"select  e.temps_reception from simulateur e where e.Nombre_simulateur = 1 ").List<int>();
                envoi_1 = session.CreateQuery(@"select  e.temps_envoi from simulateur e where e.Nombre_simulateur = 1 ").List<int>();
                conn_tout = session.CreateQuery(@"select  e.temps_connection from simulateur e  ").List<int>();
                recep_tout = session.CreateQuery(@"select  e.temps_reception from simulateur e ").List<int>();
                envoi_tout = session.CreateQuery(@"select  e.temps_envoi from simulateur e ").List<int>();
                int i = 0;
                foreach (string j in jours) {
                    IQuery query = session.CreateQuery(@"select e from simulateur e where e.Date=:j ");
                    query.SetString("j", j);
                    IList<simulateur> med = query.List<simulateur>();
                    mesures[i] = med.Count;
                    i++;
                }

            }
            catch 
            {

                session.Close();
            }
        }
        public ISession getSession(){
            return session;
        }
    }
}

и класс user.cs:

using System;
using System.Collections.Generic;
using System.Text;

namespace base_donnee
{
   public class user
    {
        public virtual string login { get; set; }
        public virtual string password { get; set; }
        public virtual string name { get; set; }
        public virtual int age { get; set; }
        public virtual string location { get; set; }
    }
}

и класс user.hbm.xml:

 <?xml version="1.0" encoding="utf-8" ?>
    <hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" assembly="base_donnee">
      <class name="base_donnee.user, base_donnee" table="user">
    <id name="login" type="string"></id>
        <property name="password" type="string" />
        <property name="age" type="int" />
        <property name="location" type="string" />
        <property name="name" type="string" />
      </class>
</hibernate-mapping>

моя проблема в том, что появляется исключение :NHibernate.ADOException :не удалось выполнить запрос [выберите пользователя0 _. Войдите как логин3 _, пользователь0 _. Пароль как пароль3 _, пользователь0 _. Возраст как возраст3 _,user0 _.location as location3 _, user0 _.name as name3 _от пользователя user0 _] [SQL :select user0 _.login as login3 _, user0 _.password as password3 _, user0 _.age as age3 _, user0 _.location as location3 _, user0 _.name as name3 _от пользователя user0 _] ---> System.Data.SqlClient.SqlException :Неверный синтаксис рядом с ключевым словом «пользователь».
мне нужны некоторые идеи, как я могу избежать этой ошибки? и почему пользователь таблицы?

0
задан Lamloumi Afif 5 May 2012 в 17:56
поделиться